@trops/dash-core 0.1.682 → 0.1.684

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.js CHANGED
@@ -13863,6 +13863,13 @@ function parseEventString(eventString) {
13863
13863
  }
13864
13864
 
13865
13865
  /** Build an event string in the canonical runtime format. */
13866
+ /**
13867
+ * Bots publish on the same bus (`bot:<ref>[<botId>].<event>`); as listener
13868
+ * sources they aren't widgets in the layout (bot-teams TEAM-012).
13869
+ */
13870
+ function isBotSource(component) {
13871
+ return typeof component === "string" && component.startsWith("bot:");
13872
+ }
13866
13873
  function formatEventString(component, itemId, event) {
13867
13874
  return "".concat(component, "[").concat(itemId, "].").concat(event);
13868
13875
  }
@@ -14052,6 +14059,7 @@ function getCurrentWiring(workspace) {
14052
14059
  * message.
14053
14060
  */
14054
14061
  function getOrphanedListeners(workspace, getWidgetConfig) {
14062
+ var botEmitters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
14055
14063
  var wiring = getCurrentWiring(workspace);
14056
14064
  if (wiring.length === 0) return [];
14057
14065
 
@@ -14083,34 +14091,55 @@ function getOrphanedListeners(workspace, getWidgetConfig) {
14083
14091
  var _iterator2 = _createForOfIteratorHelper$O(wiring),
14084
14092
  _step2;
14085
14093
  try {
14094
+ var _loop = function _loop() {
14095
+ var w = _step2.value;
14096
+ // Bot sources (TEAM-012): judged against the dashboard's bots once they
14097
+ // are known (`botEmitters`); before that, left alone.
14098
+ if (isBotSource(w.sourceComponent)) {
14099
+ if (!Array.isArray(botEmitters)) return 0; // continue
14100
+ var bot = botEmitters.find(function (b) {
14101
+ return b.component === w.sourceComponent && String(b.itemId) === String(w.sourceItemId);
14102
+ });
14103
+ if (!bot) orphans.push(_objectSpread$1b(_objectSpread$1b({}, w), {}, {
14104
+ reason: "bot-missing"
14105
+ }));else if (!bot.events.includes(w.eventName)) {
14106
+ orphans.push(_objectSpread$1b(_objectSpread$1b({}, w), {}, {
14107
+ reason: "event-not-emitted"
14108
+ }));
14109
+ }
14110
+ return 0; // continue
14111
+ }
14112
+ var srcKey = "".concat(w.sourceComponent, "|").concat(w.sourceItemId);
14113
+ var src = byCompositeKey.get(srcKey);
14114
+ if (!src) {
14115
+ // No (component, id) match. If some OTHER widget still owns
14116
+ // this id, the source component changed; otherwise it's truly
14117
+ // missing. Preserves the user's ability to see whether a
14118
+ // rename happened vs. a delete.
14119
+ var fallback = byItemId.get(String(w.sourceItemId));
14120
+ orphans.push(_objectSpread$1b(_objectSpread$1b({}, w), {}, {
14121
+ reason: fallback ? "source-component-mismatch" : "source-missing"
14122
+ }));
14123
+ return 0; // continue
14124
+ }
14125
+ if (!src.events.includes(w.eventName)) {
14126
+ orphans.push(_objectSpread$1b(_objectSpread$1b({}, w), {}, {
14127
+ reason: "event-not-emitted"
14128
+ }));
14129
+ return 0; // continue
14130
+ }
14131
+ var receiverKey = "".concat(w.receiverComponent, "|").concat(w.receiverItemId);
14132
+ var receiver = byCompositeKey.get(receiverKey);
14133
+ if (receiver && !receiver.eventHandlers.includes(w.handlerName)) {
14134
+ orphans.push(_objectSpread$1b(_objectSpread$1b({}, w), {}, {
14135
+ reason: "handler-not-declared"
14136
+ }));
14137
+ }
14138
+ },
14139
+ _ret;
14086
14140
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
14087
- var w = _step2.value;
14088
- var srcKey = "".concat(w.sourceComponent, "|").concat(w.sourceItemId);
14089
- var src = byCompositeKey.get(srcKey);
14090
- if (!src) {
14091
- // No (component, id) match. If some OTHER widget still owns
14092
- // this id, the source component changed; otherwise it's truly
14093
- // missing. Preserves the user's ability to see whether a
14094
- // rename happened vs. a delete.
14095
- var fallback = byItemId.get(String(w.sourceItemId));
14096
- orphans.push(_objectSpread$1b(_objectSpread$1b({}, w), {}, {
14097
- reason: fallback ? "source-component-mismatch" : "source-missing"
14098
- }));
14099
- continue;
14100
- }
14101
- if (!src.events.includes(w.eventName)) {
14102
- orphans.push(_objectSpread$1b(_objectSpread$1b({}, w), {}, {
14103
- reason: "event-not-emitted"
14104
- }));
14105
- continue;
14106
- }
14107
- var receiverKey = "".concat(w.receiverComponent, "|").concat(w.receiverItemId);
14108
- var receiver = byCompositeKey.get(receiverKey);
14109
- if (receiver && !receiver.eventHandlers.includes(w.handlerName)) {
14110
- orphans.push(_objectSpread$1b(_objectSpread$1b({}, w), {}, {
14111
- reason: "handler-not-declared"
14112
- }));
14113
- }
14141
+ _ret = _loop();
14142
+ if (_ret === 0) continue;
14114
14143
  }
14115
14144
  } catch (err) {
14116
14145
  _iterator2.e(err);
@@ -14202,7 +14231,9 @@ function pruneDeadListenerReferences(workspace) {
14202
14231
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
14203
14232
  var raw = _step6.value;
14204
14233
  var parsed = parseEventString(raw);
14205
- if (parsed && liveKeys.has("".concat(parsed.component, "|").concat(parsed.itemId))) {
14234
+ if (parsed && (
14235
+ // Bot sources live outside the layout — never pruned here.
14236
+ isBotSource(parsed.component) || liveKeys.has("".concat(parsed.component, "|").concat(parsed.itemId)))) {
14206
14237
  kept.push(raw);
14207
14238
  } else {
14208
14239
  removed += 1;
@@ -14365,7 +14396,7 @@ function applyToItem(listeners, _ref2) {
14365
14396
  var _iterator0 = _createForOfIteratorHelper$O(removes),
14366
14397
  _step0;
14367
14398
  try {
14368
- var _loop = function _loop() {
14399
+ var _loop2 = function _loop2() {
14369
14400
  var r = _step0.value;
14370
14401
  var target = r.handlerName;
14371
14402
  if (!target) return 0; // continue
@@ -14381,10 +14412,10 @@ function applyToItem(listeners, _ref2) {
14381
14412
  next[target] = filtered;
14382
14413
  }
14383
14414
  },
14384
- _ret;
14415
+ _ret2;
14385
14416
  for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
14386
- _ret = _loop();
14387
- if (_ret === 0) continue;
14417
+ _ret2 = _loop2();
14418
+ if (_ret2 === 0) continue;
14388
14419
  }
14389
14420
  } catch (err) {
14390
14421
  _iterator0.e(err);
@@ -19740,6 +19771,18 @@ var WidgetCardStatusBar = function WidgetCardStatusBar(_ref) {
19740
19771
  _useState4 = _slicedToArray(_useState3, 2),
19741
19772
  now = _useState4[0],
19742
19773
  setNow = _useState4[1];
19774
+ // Theme tokens + light/dark status colors so the strip follows the
19775
+ // active theme (hardcoded grays rendered dark-only).
19776
+ var _useContext = React.useContext(DashReact.ThemeContext),
19777
+ currentTheme = _useContext.currentTheme;
19778
+ var statusTokens = DashReact.useStatusTokens();
19779
+ var t = function t(key) {
19780
+ return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme[key]) || "";
19781
+ };
19782
+ // The strip renders as a sibling below the widget's Panel, so it takes
19783
+ // the Panel's corner radius and sits slightly apart from it rather
19784
+ // than butting a square edge against the rounded card.
19785
+ var panelRadius = DashReact.getStylesForItem(DashReact.themeObjects.PANEL, currentTheme, {}).borderRadius || "rounded-lg";
19743
19786
 
19744
19787
  // Check if widget declares scheduledTasks in its config
19745
19788
  var widgetConfig = item !== null && item !== void 0 && item.component ? ComponentManager.config(item.component, item) : null;
@@ -19806,27 +19849,28 @@ var WidgetCardStatusBar = function WidgetCardStatusBar(_ref) {
19806
19849
  summaryText = "".concat(tasks.length, " timers \xB7 next in ").concat(formatCountdown(soonestMs));
19807
19850
  }
19808
19851
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
19809
- className: "border-t border-gray-700/50 bg-gray-900/30 select-none ".concat(className),
19852
+ className: "mt-1 border ".concat(panelRadius, " overflow-hidden ").concat(t("border-primary-dark"), " ").concat(t("bg-primary-dark"), " select-none ").concat(className),
19810
19853
  children: [/*#__PURE__*/jsxRuntime.jsxs("button", {
19811
19854
  type: "button",
19812
19855
  onClick: function onClick() {
19813
19856
  return setExpanded(!expanded);
19814
19857
  },
19815
- className: "flex items-center w-full px-3 py-1 text-xs gap-2 cursor-pointer transition-colors hover:bg-gray-800/40 ".concat(allPaused ? "text-gray-500" : "text-blue-400"),
19858
+ className: "flex items-center w-full px-3 py-1 text-xs gap-2 cursor-pointer transition-colors ".concat(t("hover-bg-primary-dark"), " ").concat(allPaused ? "".concat(t("text-primary-medium"), " opacity-60") : t("text-secondary-medium")),
19816
19859
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
19817
19860
  icon: "clock",
19818
- className: "text-[10px] shrink-0"
19861
+ className: "text-xs shrink-0"
19819
19862
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
19820
19863
  className: "truncate flex-1 text-left",
19821
19864
  children: summaryText
19822
19865
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
19823
19866
  icon: expanded ? "chevron-up" : "chevron-down",
19824
- className: "text-[10px] text-gray-500 shrink-0"
19867
+ className: "text-xs opacity-60 shrink-0"
19825
19868
  })]
19826
19869
  }), expanded && /*#__PURE__*/jsxRuntime.jsxs("div", {
19827
19870
  className: "px-3 pb-2 pt-1 space-y-2",
19828
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
19829
- className: "text-[10px] font-semibold text-gray-400 uppercase tracking-wider",
19871
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
19872
+ block: true,
19873
+ className: "font-semibold uppercase tracking-wider",
19830
19874
  children: "Scheduled Tasks"
19831
19875
  }), tasks.map(function (task) {
19832
19876
  var remaining = task.enabled && task.nextFireAt ? task.nextFireAt - now : null;
@@ -19838,39 +19882,40 @@ var WidgetCardStatusBar = function WidgetCardStatusBar(_ref) {
19838
19882
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
19839
19883
  className: "flex items-center gap-1.5",
19840
19884
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
19841
- className: "inline-block w-1.5 h-1.5 rounded-full ".concat(task.enabled ? "bg-green-500" : "bg-gray-600")
19885
+ className: "inline-block w-1.5 h-1.5 rounded-full ".concat(task.enabled ? statusTokens.success.solidBg : t("bg-primary-medium"))
19842
19886
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
19843
- className: task.enabled ? "text-gray-200" : "text-gray-500",
19887
+ className: "".concat(t("text-primary-medium"), " ").concat(task.enabled ? "" : "opacity-60"),
19844
19888
  children: task.displayName || task.taskKey
19845
- }), !task.enabled && /*#__PURE__*/jsxRuntime.jsx("span", {
19846
- className: "text-gray-600 text-[10px]",
19889
+ }), !task.enabled && /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
19890
+ className: "opacity-70",
19847
19891
  children: "(paused)"
19848
19892
  })]
19849
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
19850
- className: "text-gray-500 text-[10px]",
19893
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
19851
19894
  children: formatScheduleDescription(task)
19852
19895
  })]
19853
- }), task.enabled && /*#__PURE__*/jsxRuntime.jsxs("div", {
19854
- className: "text-[10px] text-gray-500 pl-4 flex items-center gap-1.5",
19896
+ }), task.enabled && /*#__PURE__*/jsxRuntime.jsxs(DashReact.Caption2, {
19897
+ block: true,
19898
+ className: "pl-4 flex items-center gap-1.5",
19855
19899
  children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
19856
19900
  children: ["Next in ", formatCountdown(remaining)]
19857
19901
  }), lastFiredText && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
19858
19902
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
19859
- className: "text-gray-700",
19903
+ className: "opacity-50",
19860
19904
  children: "\xB7"
19861
19905
  }), /*#__PURE__*/jsxRuntime.jsxs("span", {
19862
19906
  children: ["Last: ", lastFiredText]
19863
19907
  })]
19864
19908
  }), task.fireCount > 0 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
19865
19909
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
19866
- className: "text-gray-700",
19910
+ className: "opacity-50",
19867
19911
  children: "\xB7"
19868
19912
  }), /*#__PURE__*/jsxRuntime.jsxs("span", {
19869
19913
  children: ["#", task.fireCount]
19870
19914
  })]
19871
19915
  })]
19872
- }), !task.enabled && /*#__PURE__*/jsxRuntime.jsx("div", {
19873
- className: "text-[10px] text-gray-600 pl-4",
19916
+ }), !task.enabled && /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
19917
+ block: true,
19918
+ className: "pl-4 opacity-70",
19874
19919
  children: formatScheduleDescription(task)
19875
19920
  })]
19876
19921
  }, task.taskId);
@@ -48511,6 +48556,443 @@ function SharedFieldRow(_ref6) {
48511
48556
  function _createForOfIteratorHelper$q(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$q(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
48512
48557
  function _unsupportedIterableToArray$q(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$q(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$q(r, a) : void 0; } }
48513
48558
  function _arrayLikeToArray$q(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
48559
+
48560
+ /**
48561
+ * @param {Array<object>} workspaces dashboards (each with id, name, layout/pages)
48562
+ * @param {(component: string) => object|null} getWidgetConfig
48563
+ * @returns {Array<{ workspaceId: string, name: string,
48564
+ * widgets: Array<{ ref: string, instanceId: string, label: string, events: string[] }> }>}
48565
+ * dashboards with at least one event-emitting widget
48566
+ */
48567
+ function buildWidgetEventCatalog(workspaces, getWidgetConfig) {
48568
+ if (!Array.isArray(workspaces)) return [];
48569
+ var out = [];
48570
+ var _iterator = _createForOfIteratorHelper$q(workspaces),
48571
+ _step;
48572
+ try {
48573
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
48574
+ var ws = _step.value;
48575
+ if (!ws || ws.id === undefined || ws.id === null) continue;
48576
+ var widgets = getEmitters(ws, getWidgetConfig).filter(function (e) {
48577
+ return e.itemId != null && e.events.length;
48578
+ }).map(function (e) {
48579
+ return {
48580
+ ref: e.component,
48581
+ instanceId: String(e.itemId),
48582
+ label: e.label || e.component,
48583
+ events: e.events
48584
+ };
48585
+ });
48586
+ if (!widgets.length) continue;
48587
+ out.push({
48588
+ workspaceId: String(ws.id),
48589
+ name: ws.name || "Dashboard ".concat(ws.id),
48590
+ widgets: widgets
48591
+ });
48592
+ }
48593
+ // Dashboards can share a name (e.g. copies of "Kitchen Sink"); number the
48594
+ // duplicates so each picker entry is distinguishable.
48595
+ } catch (err) {
48596
+ _iterator.e(err);
48597
+ } finally {
48598
+ _iterator.f();
48599
+ }
48600
+ var totals = {};
48601
+ for (var _i = 0, _out = out; _i < _out.length; _i++) {
48602
+ var w = _out[_i];
48603
+ totals[w.name] = (totals[w.name] || 0) + 1;
48604
+ }
48605
+ var seen = {};
48606
+ for (var _i2 = 0, _out2 = out; _i2 < _out2.length; _i2++) {
48607
+ var _w = _out2[_i2];
48608
+ if (totals[_w.name] > 1) {
48609
+ seen[_w.name] = (seen[_w.name] || 0) + 1;
48610
+ _w.name = "".concat(_w.name, " (").concat(seen[_w.name], ")");
48611
+ }
48612
+ }
48613
+ return out;
48614
+ }
48615
+
48616
+ /** A subscription to one widget event, picked from the catalog. */
48617
+ function widgetSubscription(workspace, widget, event) {
48618
+ return {
48619
+ eventType: formatEventString(widget.ref, widget.instanceId, event),
48620
+ source: {
48621
+ kind: "widget",
48622
+ ref: widget.ref,
48623
+ instanceId: widget.instanceId,
48624
+ event: event,
48625
+ workspaceId: workspace.workspaceId
48626
+ },
48627
+ label: "".concat(workspace.name, " \u203A ").concat(widget.label, " \u203A ").concat(event)
48628
+ };
48629
+ }
48630
+
48631
+ /**
48632
+ * How to show a saved subscription: its label from the live catalog, and
48633
+ * whether its widget/event is gone (`missing`). Subscriptions saved before
48634
+ * the picker (bare eventType) get a friendly label when they still resolve;
48635
+ * otherwise they show as typed.
48636
+ */
48637
+ function describeSubscription(sub, catalog) {
48638
+ var botCatalog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
48639
+ var eventType = sub && sub.eventType;
48640
+ // Bot subscriptions resolve against the bot catalog; `kind` lets the form
48641
+ // say "bot missing" instead of "widget missing".
48642
+ if (sub && sub.source && sub.source.kind === "bot") {
48643
+ var _iterator2 = _createForOfIteratorHelper$q(botCatalog || []),
48644
+ _step2;
48645
+ try {
48646
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
48647
+ var b = _step2.value;
48648
+ var _iterator3 = _createForOfIteratorHelper$q(b.events),
48649
+ _step3;
48650
+ try {
48651
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
48652
+ var ev = _step3.value;
48653
+ var s = botSubscription(b, ev);
48654
+ if (s.eventType === eventType) {
48655
+ return {
48656
+ label: s.label,
48657
+ missing: false,
48658
+ kind: "bot"
48659
+ };
48660
+ }
48661
+ }
48662
+ } catch (err) {
48663
+ _iterator3.e(err);
48664
+ } finally {
48665
+ _iterator3.f();
48666
+ }
48667
+ }
48668
+ } catch (err) {
48669
+ _iterator2.e(err);
48670
+ } finally {
48671
+ _iterator2.f();
48672
+ }
48673
+ return {
48674
+ label: sub.label || eventType,
48675
+ missing: true,
48676
+ kind: "bot"
48677
+ };
48678
+ }
48679
+ var _iterator4 = _createForOfIteratorHelper$q(catalog || []),
48680
+ _step4;
48681
+ try {
48682
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
48683
+ var ws = _step4.value;
48684
+ var _iterator5 = _createForOfIteratorHelper$q(ws.widgets),
48685
+ _step5;
48686
+ try {
48687
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
48688
+ var w = _step5.value;
48689
+ var _iterator6 = _createForOfIteratorHelper$q(w.events),
48690
+ _step6;
48691
+ try {
48692
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
48693
+ var _ev = _step6.value;
48694
+ if (formatEventString(w.ref, w.instanceId, _ev) === eventType) {
48695
+ return {
48696
+ label: widgetSubscription(ws, w, _ev).label,
48697
+ missing: false
48698
+ };
48699
+ }
48700
+ }
48701
+ } catch (err) {
48702
+ _iterator6.e(err);
48703
+ } finally {
48704
+ _iterator6.f();
48705
+ }
48706
+ }
48707
+ } catch (err) {
48708
+ _iterator5.e(err);
48709
+ } finally {
48710
+ _iterator5.f();
48711
+ }
48712
+ }
48713
+ } catch (err) {
48714
+ _iterator4.e(err);
48715
+ } finally {
48716
+ _iterator4.f();
48717
+ }
48718
+ if (sub && sub.source) {
48719
+ return {
48720
+ label: sub.label || eventType,
48721
+ missing: true
48722
+ };
48723
+ }
48724
+ return {
48725
+ label: eventType || "",
48726
+ missing: false
48727
+ };
48728
+ }
48729
+
48730
+ /**
48731
+ * Events other bots publish (bot:<ref>[<botId>].<event>, PRD US-010), for the
48732
+ * "Another bot" side of the picker. Derived from each bot's settings — never
48733
+ * hand-declared: Completed, Failed, and one `tool.<providerType>.<tool>` per
48734
+ * tool the bot may use (the provider's tools, narrowed by the bot's
48735
+ * selection). Providers with no known type or tool list are skipped.
48736
+ *
48737
+ * @param {Array<object>} bots
48738
+ * @param {Array<{name, type, tools}>} toolSources bots.listToolSources()
48739
+ * @param {string} [excludeBotId] the bot being edited — can't trigger itself
48740
+ */
48741
+ function buildBotEventCatalog(bots, toolSources) {
48742
+ var excludeBotId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
48743
+ if (!Array.isArray(bots)) return [];
48744
+ var sources = Array.isArray(toolSources) ? toolSources : [];
48745
+ var out = [];
48746
+ var _iterator7 = _createForOfIteratorHelper$q(bots),
48747
+ _step7;
48748
+ try {
48749
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
48750
+ var bot = _step7.value;
48751
+ if (!bot || !bot.id || !bot.ref || bot.id === excludeBotId) continue;
48752
+ var events = [{
48753
+ event: "completed",
48754
+ label: "Completed"
48755
+ }, {
48756
+ event: "failed",
48757
+ label: "Failed"
48758
+ }];
48759
+ var _iterator8 = _createForOfIteratorHelper$q(bot.mcpServers || []),
48760
+ _step8;
48761
+ try {
48762
+ var _loop = function _loop() {
48763
+ var provider = _step8.value;
48764
+ var src = sources.find(function (s) {
48765
+ return s && s.name === provider;
48766
+ });
48767
+ if (!src || !src.type || !Array.isArray(src.tools)) return 1; // continue
48768
+ var sel = bot.toolSelections && bot.toolSelections[provider];
48769
+ var tools = Array.isArray(sel) ? src.tools.filter(function (t) {
48770
+ return sel.includes(t);
48771
+ }) : src.tools;
48772
+ var _iterator9 = _createForOfIteratorHelper$q(tools),
48773
+ _step9;
48774
+ try {
48775
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
48776
+ var tool = _step9.value;
48777
+ events.push({
48778
+ event: "tool.".concat(src.type, ".").concat(tool),
48779
+ label: "".concat(provider, " \u203A ").concat(tool)
48780
+ });
48781
+ }
48782
+ } catch (err) {
48783
+ _iterator9.e(err);
48784
+ } finally {
48785
+ _iterator9.f();
48786
+ }
48787
+ };
48788
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
48789
+ if (_loop()) continue;
48790
+ }
48791
+ } catch (err) {
48792
+ _iterator8.e(err);
48793
+ } finally {
48794
+ _iterator8.f();
48795
+ }
48796
+ out.push({
48797
+ botId: bot.id,
48798
+ ref: bot.ref,
48799
+ name: bot.name || bot.id,
48800
+ events: events
48801
+ });
48802
+ }
48803
+ } catch (err) {
48804
+ _iterator7.e(err);
48805
+ } finally {
48806
+ _iterator7.f();
48807
+ }
48808
+ return out;
48809
+ }
48810
+
48811
+ /** A subscription to one bot event, picked from the bot catalog. */
48812
+ function botSubscription(botEntry, ev) {
48813
+ return {
48814
+ eventType: "bot:".concat(botEntry.ref, "[").concat(botEntry.botId, "].").concat(ev.event),
48815
+ source: {
48816
+ kind: "bot",
48817
+ ref: botEntry.ref,
48818
+ instanceId: botEntry.botId,
48819
+ event: ev.event
48820
+ },
48821
+ label: "".concat(botEntry.name, " \u203A ").concat(ev.label)
48822
+ };
48823
+ }
48824
+ function botEventLabel(ev) {
48825
+ if (!ev.event.startsWith("tool.")) return ev.label;
48826
+ // Tool events are labelled "<provider> › <tool>" in the catalog.
48827
+ var _String$split = String(ev.label).split(" › "),
48828
+ _String$split2 = _slicedToArray(_String$split, 2),
48829
+ provider = _String$split2[0],
48830
+ tool = _String$split2[1];
48831
+ return tool ? "uses ".concat(tool, " (").concat(provider, ")") : ev.label;
48832
+ }
48833
+
48834
+ /**
48835
+ * Everything that can trigger a bot, flattened for one "Runs when…" picker
48836
+ * (bot-teams TEAM-012): `{ value, label, group, subscription }`, value = the
48837
+ * subscription's eventType.
48838
+ *
48839
+ * A team bot only runs on its own dashboard's events, so it's offered that
48840
+ * dashboard's widgets ("Widgets on <dashboard>") and its teammates ("Bots on
48841
+ * this team"). An unassigned bot is offered every dashboard's widgets and
48842
+ * every bot ("Bots", labelled with their dashboard). The bot itself and
48843
+ * triggers it already has are left out; two copies of one widget are
48844
+ * numbered.
48845
+ *
48846
+ * @param {{ team: string|null, workspaces: object[], getWidgetConfig: Function,
48847
+ * bots: object[], toolSources: object[], botId?: string,
48848
+ * existing?: string[] }} input
48849
+ */
48850
+ function buildTriggerOptions(_ref) {
48851
+ var _ref$team = _ref.team,
48852
+ team = _ref$team === void 0 ? null : _ref$team,
48853
+ _ref$workspaces = _ref.workspaces,
48854
+ workspaces = _ref$workspaces === void 0 ? [] : _ref$workspaces,
48855
+ _ref$getWidgetConfig = _ref.getWidgetConfig,
48856
+ getWidgetConfig = _ref$getWidgetConfig === void 0 ? null : _ref$getWidgetConfig,
48857
+ _ref$bots = _ref.bots,
48858
+ bots = _ref$bots === void 0 ? [] : _ref$bots,
48859
+ _ref$toolSources = _ref.toolSources,
48860
+ toolSources = _ref$toolSources === void 0 ? [] : _ref$toolSources,
48861
+ _ref$botId = _ref.botId,
48862
+ botId = _ref$botId === void 0 ? null : _ref$botId,
48863
+ _ref$existing = _ref.existing,
48864
+ existing = _ref$existing === void 0 ? [] : _ref$existing;
48865
+ var teamKey = team === null || team === undefined || team === "" ? null : String(team);
48866
+ var taken = new Set(existing || []);
48867
+ var out = [];
48868
+
48869
+ // Widgets.
48870
+ var wsList = (Array.isArray(workspaces) ? workspaces : []).filter(function (ws) {
48871
+ return ws && (teamKey === null || String(ws.id) === teamKey);
48872
+ });
48873
+ var _iterator0 = _createForOfIteratorHelper$q(buildWidgetEventCatalog(wsList, getWidgetConfig)),
48874
+ _step0;
48875
+ try {
48876
+ for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
48877
+ var ws = _step0.value;
48878
+ var group = "Widgets on ".concat(ws.name);
48879
+ var seen = {};
48880
+ var _iterator10 = _createForOfIteratorHelper$q(ws.widgets),
48881
+ _step10;
48882
+ try {
48883
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
48884
+ var widget = _step10.value;
48885
+ seen[widget.label] = (seen[widget.label] || 0) + 1;
48886
+ var name = seen[widget.label] > 1 ? "".concat(widget.label, " (").concat(seen[widget.label], ")") : widget.label;
48887
+ var _iterator11 = _createForOfIteratorHelper$q(widget.events),
48888
+ _step11;
48889
+ try {
48890
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
48891
+ var event = _step11.value;
48892
+ var subscription = widgetSubscription(ws, widget, event);
48893
+ if (taken.has(subscription.eventType)) continue;
48894
+ out.push({
48895
+ value: subscription.eventType,
48896
+ label: "".concat(name, " \u203A ").concat(event),
48897
+ group: group,
48898
+ subscription: subscription
48899
+ });
48900
+ }
48901
+ } catch (err) {
48902
+ _iterator11.e(err);
48903
+ } finally {
48904
+ _iterator11.f();
48905
+ }
48906
+ }
48907
+ } catch (err) {
48908
+ _iterator10.e(err);
48909
+ } finally {
48910
+ _iterator10.f();
48911
+ }
48912
+ }
48913
+
48914
+ // Bots.
48915
+ } catch (err) {
48916
+ _iterator0.e(err);
48917
+ } finally {
48918
+ _iterator0.f();
48919
+ }
48920
+ var nameOfWs = new Map((Array.isArray(workspaces) ? workspaces : []).filter(Boolean).map(function (ws) {
48921
+ return [String(ws.id), ws.name || "Dashboard ".concat(ws.id)];
48922
+ }));
48923
+ var candidates = (Array.isArray(bots) ? bots : []).filter(function (b) {
48924
+ return b && (teamKey === null || b.workspaceId !== null && b.workspaceId !== undefined && String(b.workspaceId) === teamKey);
48925
+ });
48926
+ var wsOf = new Map(candidates.map(function (b) {
48927
+ return [b.id, b.workspaceId];
48928
+ }));
48929
+ var _iterator1 = _createForOfIteratorHelper$q(buildBotEventCatalog(candidates, toolSources, botId)),
48930
+ _step1;
48931
+ try {
48932
+ for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
48933
+ var entry = _step1.value;
48934
+ var where = teamKey === null && wsOf.get(entry.botId) !== null && wsOf.get(entry.botId) !== undefined ? " (".concat(nameOfWs.get(String(wsOf.get(entry.botId))) || "another dashboard", ")") : "";
48935
+ var _iterator12 = _createForOfIteratorHelper$q(entry.events),
48936
+ _step12;
48937
+ try {
48938
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
48939
+ var ev = _step12.value;
48940
+ var _subscription = botSubscription(entry, ev);
48941
+ if (taken.has(_subscription.eventType)) continue;
48942
+ out.push({
48943
+ value: _subscription.eventType,
48944
+ label: "".concat(entry.name).concat(where, " \u203A ").concat(botEventLabel(ev)),
48945
+ group: teamKey === null ? "Bots" : "Bots on this team",
48946
+ subscription: _subscription
48947
+ });
48948
+ }
48949
+ } catch (err) {
48950
+ _iterator12.e(err);
48951
+ } finally {
48952
+ _iterator12.f();
48953
+ }
48954
+ }
48955
+ } catch (err) {
48956
+ _iterator1.e(err);
48957
+ } finally {
48958
+ _iterator1.f();
48959
+ }
48960
+ return out;
48961
+ }
48962
+
48963
+ /**
48964
+ * A dashboard's bots as Dashboard Config › Listeners sources (bot-teams
48965
+ * TEAM-012), shaped like getEmitters() entries: component `bot:<ref>`,
48966
+ * itemId = bot id, so a wired handler stores `bot:<ref>[<botId>].<event>` —
48967
+ * exactly what bots publish on the bus.
48968
+ *
48969
+ * @param {object[]} bots
48970
+ * @param {object[]} toolSources bots.listToolSources()
48971
+ * @param {string|number} workspaceId
48972
+ */
48973
+ function getBotEmitters(bots, toolSources, workspaceId) {
48974
+ if (workspaceId === null || workspaceId === undefined || workspaceId === "") {
48975
+ return [];
48976
+ }
48977
+ var team = (Array.isArray(bots) ? bots : []).filter(function (b) {
48978
+ return b && b.workspaceId !== null && b.workspaceId !== undefined && String(b.workspaceId) === String(workspaceId);
48979
+ });
48980
+ return buildBotEventCatalog(team, toolSources).map(function (entry) {
48981
+ return {
48982
+ key: "bot:".concat(entry.ref, "|").concat(entry.botId),
48983
+ component: "bot:".concat(entry.ref),
48984
+ itemId: entry.botId,
48985
+ label: "".concat(entry.name, " (bot)"),
48986
+ events: entry.events.map(function (e) {
48987
+ return e.event;
48988
+ })
48989
+ };
48990
+ });
48991
+ }
48992
+
48993
+ function _createForOfIteratorHelper$p(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$p(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
48994
+ function _unsupportedIterableToArray$p(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$p(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$p(r, a) : void 0; } }
48995
+ function _arrayLikeToArray$p(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
48514
48996
  var PermissionsTab = function PermissionsTab(_ref) {
48515
48997
  var workspace = _ref.workspace;
48516
48998
  var _React$useContext = React.useContext(AppContext),
@@ -48737,7 +49219,7 @@ var PermissionsTab = function PermissionsTab(_ref) {
48737
49219
  return _context4.abrupt("return");
48738
49220
  case 3:
48739
49221
  next = currentGrant;
48740
- _iterator = _createForOfIteratorHelper$q(declaredTools);
49222
+ _iterator = _createForOfIteratorHelper$p(declaredTools);
48741
49223
  try {
48742
49224
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
48743
49225
  tool = _step.value;
@@ -48897,7 +49379,7 @@ var PermissionsTab = function PermissionsTab(_ref) {
48897
49379
  }
48898
49380
  }
48899
49381
  targets = labels.length > 0 ? labels : [serverName];
48900
- _iterator2 = _createForOfIteratorHelper$q(targets);
49382
+ _iterator2 = _createForOfIteratorHelper$p(targets);
48901
49383
  _context8.prev = 1;
48902
49384
  _iterator2.s();
48903
49385
  case 2:
@@ -48953,7 +49435,7 @@ var PermissionsTab = function PermissionsTab(_ref) {
48953
49435
  case 0:
48954
49436
  setBusy(true);
48955
49437
  _context9.prev = 1;
48956
- _iterator3 = _createForOfIteratorHelper$q(filteredRows);
49438
+ _iterator3 = _createForOfIteratorHelper$p(filteredRows);
48957
49439
  _context9.prev = 2;
48958
49440
  _iterator3.s();
48959
49441
  case 3:
@@ -49012,7 +49494,7 @@ var PermissionsTab = function PermissionsTab(_ref) {
49012
49494
  case 0:
49013
49495
  setBusy(true);
49014
49496
  _context0.prev = 1;
49015
- _iterator4 = _createForOfIteratorHelper$q(filteredRows);
49497
+ _iterator4 = _createForOfIteratorHelper$p(filteredRows);
49016
49498
  _context0.prev = 2;
49017
49499
  _iterator4.s();
49018
49500
  case 3:
@@ -49172,9 +49654,9 @@ var PermissionsTab = function PermissionsTab(_ref) {
49172
49654
  });
49173
49655
  };
49174
49656
 
49175
- function _createForOfIteratorHelper$p(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$p(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
49176
- function _unsupportedIterableToArray$p(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$p(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$p(r, a) : void 0; } }
49177
- function _arrayLikeToArray$p(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
49657
+ function _createForOfIteratorHelper$o(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$o(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
49658
+ function _unsupportedIterableToArray$o(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$o(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$o(r, a) : void 0; } }
49659
+ function _arrayLikeToArray$o(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
49178
49660
  /**
49179
49661
  * teamUtils.js
49180
49662
  *
@@ -49207,7 +49689,7 @@ function dashboardOptions(workspaces) {
49207
49689
  return w && norm(w.id) !== null;
49208
49690
  });
49209
49691
  var totals = {};
49210
- var _iterator = _createForOfIteratorHelper$p(list),
49692
+ var _iterator = _createForOfIteratorHelper$o(list),
49211
49693
  _step;
49212
49694
  try {
49213
49695
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -49254,7 +49736,7 @@ function groupBotsByTeam(bots, workspaces) {
49254
49736
  label: "Unassigned",
49255
49737
  bots: []
49256
49738
  };
49257
- var _iterator2 = _createForOfIteratorHelper$p(list),
49739
+ var _iterator2 = _createForOfIteratorHelper$o(list),
49258
49740
  _step2;
49259
49741
  try {
49260
49742
  var _loop = function _loop() {
@@ -49995,9 +50477,9 @@ var BotsTab = function BotsTab(_ref2) {
49995
50477
  });
49996
50478
  };
49997
50479
 
49998
- function _createForOfIteratorHelper$o(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$o(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
49999
- function _unsupportedIterableToArray$o(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$o(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$o(r, a) : void 0; } }
50000
- function _arrayLikeToArray$o(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
50480
+ function _createForOfIteratorHelper$n(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$n(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
50481
+ function _unsupportedIterableToArray$n(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$n(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$n(r, a) : void 0; } }
50482
+ function _arrayLikeToArray$n(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
50001
50483
  function ownKeys$A(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
50002
50484
  function _objectSpread$A(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$A(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$A(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
50003
50485
  var ConfigTab = function ConfigTab(_ref) {
@@ -50156,7 +50638,7 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50156
50638
  };
50157
50639
  if (!appProviders) return byType;
50158
50640
  if (Array.isArray(appProviders)) {
50159
- var _iterator = _createForOfIteratorHelper$o(appProviders),
50641
+ var _iterator = _createForOfIteratorHelper$n(appProviders),
50160
50642
  _step;
50161
50643
  try {
50162
50644
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -50222,7 +50704,7 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50222
50704
  });
50223
50705
  }
50224
50706
  if (Array.isArray(workspace === null || workspace === void 0 ? void 0 : workspace.pages)) {
50225
- var _iterator2 = _createForOfIteratorHelper$o(workspace.pages),
50707
+ var _iterator2 = _createForOfIteratorHelper$n(workspace.pages),
50226
50708
  _step2;
50227
50709
  try {
50228
50710
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -50249,7 +50731,7 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50249
50731
  var visitedByLocation = new WeakSet();
50250
50732
  var _collect = function collect(items, location) {
50251
50733
  if (!Array.isArray(items)) return;
50252
- var _iterator3 = _createForOfIteratorHelper$o(items),
50734
+ var _iterator3 = _createForOfIteratorHelper$n(items),
50253
50735
  _step3;
50254
50736
  try {
50255
50737
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
@@ -50320,9 +50802,33 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50320
50802
  return null;
50321
50803
  };
50322
50804
  }, [getWidgetConfig]);
50805
+ // This dashboard's bots as Listeners sources (TEAM-012); null until
50806
+ // loaded so their wiring isn't judged before the bots are known.
50807
+ var _useState9 = React.useState(null),
50808
+ _useState0 = _slicedToArray(_useState9, 2),
50809
+ botEmitters = _useState0[0],
50810
+ setBotEmitters = _useState0[1];
50811
+ var workspaceId = workspace ? workspace.id : null;
50812
+ React.useEffect(function () {
50813
+ var _window$mainApi;
50814
+ var bots = typeof window !== "undefined" && ((_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 ? void 0 : _window$mainApi.bots);
50815
+ if (!isOpen || !bots || !bots.list || workspaceId == null) return undefined;
50816
+ var alive = true;
50817
+ Promise.all([bots.list(), bots.listToolSources ? bots.listToolSources() : Promise.resolve([])]).then(function (_ref5) {
50818
+ var _ref6 = _slicedToArray(_ref5, 2),
50819
+ list = _ref6[0],
50820
+ sources = _ref6[1];
50821
+ if (alive) setBotEmitters(getBotEmitters(list, sources, workspaceId));
50822
+ })["catch"](function () {
50823
+ if (alive) setBotEmitters([]);
50824
+ });
50825
+ return function () {
50826
+ alive = false;
50827
+ };
50828
+ }, [isOpen, workspaceId]);
50323
50829
  var emitters = React.useMemo(function () {
50324
- return getEmitters(workspace, wConfig);
50325
- }, [workspace, wConfig]);
50830
+ return [].concat(_toConsumableArray(getEmitters(workspace, wConfig)), _toConsumableArray(botEmitters || []));
50831
+ }, [workspace, wConfig, botEmitters]);
50326
50832
  var receivers = React.useMemo(function () {
50327
50833
  return getReceivers(workspace, wConfig);
50328
50834
  }, [workspace, wConfig]);
@@ -50330,8 +50836,8 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50330
50836
  return getCurrentWiring(workspace);
50331
50837
  }, [workspace]);
50332
50838
  var orphans = React.useMemo(function () {
50333
- return getOrphanedListeners(workspace, wConfig);
50334
- }, [workspace, wConfig]);
50839
+ return getOrphanedListeners(workspace, wConfig, botEmitters);
50840
+ }, [workspace, wConfig, botEmitters]);
50335
50841
  var effectiveWiring = React.useMemo(function () {
50336
50842
  // Apply staged removes/adds to the persisted wiring for an
50337
50843
  // accurate "what will be there after save" view, then annotate
@@ -50347,7 +50853,7 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50347
50853
  }
50348
50854
  if (stagedListeners.adds.length > 0) {
50349
50855
  // Append; avoid duplicates against current state.
50350
- var _iterator4 = _createForOfIteratorHelper$o(stagedListeners.adds),
50856
+ var _iterator4 = _createForOfIteratorHelper$n(stagedListeners.adds),
50351
50857
  _step4;
50352
50858
  try {
50353
50859
  var _loop = function _loop() {
@@ -50371,7 +50877,7 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50371
50877
  }
50372
50878
  if (orphans.length === 0) return next;
50373
50879
  var orphanIndex = new Map();
50374
- var _iterator5 = _createForOfIteratorHelper$o(orphans),
50880
+ var _iterator5 = _createForOfIteratorHelper$n(orphans),
50375
50881
  _step5;
50376
50882
  try {
50377
50883
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
@@ -50413,7 +50919,7 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50413
50919
  function stagePrefFieldForAll(targetWidgets, key, value) {
50414
50920
  setStagedPrefs(function (prev) {
50415
50921
  var next = _objectSpread$A({}, prev);
50416
- var _iterator6 = _createForOfIteratorHelper$o(targetWidgets),
50922
+ var _iterator6 = _createForOfIteratorHelper$n(targetWidgets),
50417
50923
  _step6;
50418
50924
  try {
50419
50925
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
@@ -50458,7 +50964,7 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50458
50964
  });
50459
50965
  setStaged(function (prev) {
50460
50966
  var next = _objectSpread$A({}, prev);
50461
- var _iterator7 = _createForOfIteratorHelper$o(affected),
50967
+ var _iterator7 = _createForOfIteratorHelper$n(affected),
50462
50968
  _step7;
50463
50969
  try {
50464
50970
  for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
@@ -50759,29 +51265,29 @@ var DashboardConfigModal = function DashboardConfigModal(_ref2) {
50759
51265
  * write fails the user can re-toggle. No staging — the bulk modal
50760
51266
  * doesn't gate the user behind a Save button for boolean prefs.
50761
51267
  */
50762
- function NotificationsTab(_ref5) {
50763
- var workspace = _ref5.workspace;
51268
+ function NotificationsTab(_ref7) {
51269
+ var workspace = _ref7.workspace;
50764
51270
  var _useConfigTokens3 = useConfigTokens(),
50765
51271
  muted = _useConfigTokens3.muted,
50766
51272
  hairline = _useConfigTokens3.hairline;
50767
- var _useState9 = React.useState(""),
50768
- _useState0 = _slicedToArray(_useState9, 2),
50769
- searchQuery = _useState0[0],
50770
- setSearchQuery = _useState0[1];
51273
+ var _useState1 = React.useState(""),
51274
+ _useState10 = _slicedToArray(_useState1, 2),
51275
+ searchQuery = _useState10[0],
51276
+ setSearchQuery = _useState10[1];
50771
51277
  // Local mirror of widgetUuid -> { typeKey: bool }. Seeded from the
50772
51278
  // main process on mount; updated optimistically on toggle.
50773
- var _useState1 = React.useState({}),
50774
- _useState10 = _slicedToArray(_useState1, 2),
50775
- prefs = _useState10[0],
50776
- setPrefs = _useState10[1];
50777
- var _useState11 = React.useState(false),
51279
+ var _useState11 = React.useState({}),
50778
51280
  _useState12 = _slicedToArray(_useState11, 2),
50779
- loaded = _useState12[0],
50780
- setLoaded = _useState12[1];
51281
+ prefs = _useState12[0],
51282
+ setPrefs = _useState12[1];
51283
+ var _useState13 = React.useState(false),
51284
+ _useState14 = _slicedToArray(_useState13, 2),
51285
+ loaded = _useState14[0],
51286
+ setLoaded = _useState14[1];
50781
51287
  React.useEffect(function () {
50782
- var _window$mainApi;
51288
+ var _window$mainApi2;
50783
51289
  var cancelled = false;
50784
- if (!((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && (_window$mainApi = _window$mainApi.notifications) !== null && _window$mainApi !== void 0 && _window$mainApi.getPreferences)) {
51290
+ if (!((_window$mainApi2 = window.mainApi) !== null && _window$mainApi2 !== void 0 && (_window$mainApi2 = _window$mainApi2.notifications) !== null && _window$mainApi2 !== void 0 && _window$mainApi2.getPreferences)) {
50785
51291
  setLoaded(true);
50786
51292
  return function () {
50787
51293
  cancelled = true;
@@ -50875,11 +51381,11 @@ function NotificationsTab(_ref5) {
50875
51381
  return !!defaultEnabled;
50876
51382
  };
50877
51383
  var setOne = function setOne(uuid, typeKey, value) {
50878
- var _window$mainApi2;
51384
+ var _window$mainApi3;
50879
51385
  setPrefs(function (prev) {
50880
51386
  return _objectSpread$A(_objectSpread$A({}, prev), {}, _defineProperty({}, uuid, _objectSpread$A(_objectSpread$A({}, prev[uuid] || {}), {}, _defineProperty({}, typeKey, value))));
50881
51387
  });
50882
- (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.notifications) === null || _window$mainApi2 === void 0 || _window$mainApi2.setPreferences(uuid, _defineProperty({}, typeKey, value));
51388
+ (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.notifications) === null || _window$mainApi3 === void 0 || _window$mainApi3.setPreferences(uuid, _defineProperty({}, typeKey, value));
50883
51389
  };
50884
51390
  var setAllVisible = function setAllVisible(value) {
50885
51391
  // Update local state in one pass + fire one IPC per widget.
@@ -50895,12 +51401,12 @@ function NotificationsTab(_ref5) {
50895
51401
  return next;
50896
51402
  });
50897
51403
  filtered.forEach(function (wi) {
50898
- var _window$mainApi3;
51404
+ var _window$mainApi4;
50899
51405
  var update = {};
50900
51406
  wi.notifications.forEach(function (n) {
50901
51407
  update[n.key] = value;
50902
51408
  });
50903
- (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.notifications) === null || _window$mainApi3 === void 0 || _window$mainApi3.setPreferences(wi.uuid, update);
51409
+ (_window$mainApi4 = window.mainApi) === null || _window$mainApi4 === void 0 || (_window$mainApi4 = _window$mainApi4.notifications) === null || _window$mainApi4 === void 0 || _window$mainApi4.setPreferences(wi.uuid, update);
50904
51410
  });
50905
51411
  };
50906
51412
  if (!loaded) {
@@ -51004,12 +51510,12 @@ function NotificationsTab(_ref5) {
51004
51510
  * dot per-type when any widget of that type is unresolved). Column 2
51005
51511
  * shows the selected type's bulk dropdown + per-widget dropdowns.
51006
51512
  */
51007
- function ProvidersTab(_ref6) {
51513
+ function ProvidersTab(_ref8) {
51008
51514
  var _typeEntries$, _selectedRows$;
51009
- var grouped = _ref6.grouped,
51010
- providersByType = _ref6.providersByType,
51011
- onBulk = _ref6.onBulk,
51012
- onPerWidget = _ref6.onPerWidget;
51515
+ var grouped = _ref8.grouped,
51516
+ providersByType = _ref8.providersByType,
51517
+ onBulk = _ref8.onBulk,
51518
+ onPerWidget = _ref8.onPerWidget;
51013
51519
  var _useConfigTokens4 = useConfigTokens(),
51014
51520
  muted = _useConfigTokens4.muted,
51015
51521
  hairline = _useConfigTokens4.hairline,
@@ -51017,10 +51523,10 @@ function ProvidersTab(_ref6) {
51017
51523
  var typeEntries = React.useMemo(function () {
51018
51524
  return Array.from(grouped.entries());
51019
51525
  }, [grouped]);
51020
- var _useState13 = React.useState(((_typeEntries$ = typeEntries[0]) === null || _typeEntries$ === void 0 ? void 0 : _typeEntries$[0]) || null),
51021
- _useState14 = _slicedToArray(_useState13, 2),
51022
- selectedType = _useState14[0],
51023
- setSelectedType = _useState14[1];
51526
+ var _useState15 = React.useState(((_typeEntries$ = typeEntries[0]) === null || _typeEntries$ === void 0 ? void 0 : _typeEntries$[0]) || null),
51527
+ _useState16 = _slicedToArray(_useState15, 2),
51528
+ selectedType = _useState16[0],
51529
+ setSelectedType = _useState16[1];
51024
51530
 
51025
51531
  // If the selected type disappears (workspace changed), fall back.
51026
51532
  React.useMemo(function () {
@@ -51050,10 +51556,10 @@ function ProvidersTab(_ref6) {
51050
51556
  children: "Provider Types"
51051
51557
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
51052
51558
  className: "overflow-y-auto flex-1 flex flex-col gap-1",
51053
- children: typeEntries.map(function (_ref7) {
51054
- var _ref8 = _slicedToArray(_ref7, 2),
51055
- providerType = _ref8[0],
51056
- rows = _ref8[1];
51559
+ children: typeEntries.map(function (_ref9) {
51560
+ var _ref0 = _slicedToArray(_ref9, 2),
51561
+ providerType = _ref0[0],
51562
+ rows = _ref0[1];
51057
51563
  var unresolvedHere = rows.filter(function (r) {
51058
51564
  return r.required && !r.resolvedProviderName;
51059
51565
  }).length;
@@ -51196,8 +51702,8 @@ function ProvidersTab(_ref6) {
51196
51702
  * package (no `config.id` / `config.package` / item.workspace hint).
51197
51703
  * Usually this is a stale layout item whose widget got uninstalled.
51198
51704
  */
51199
- function DependenciesTab(_ref0) {
51200
- var dependencies = _ref0.dependencies;
51705
+ function DependenciesTab(_ref10) {
51706
+ var dependencies = _ref10.dependencies;
51201
51707
  var _useConfigTokens5 = useConfigTokens(),
51202
51708
  muted = _useConfigTokens5.muted,
51203
51709
  hairline = _useConfigTokens5.hairline;
@@ -51274,24 +51780,24 @@ function sameWiringEntry(a, b) {
51274
51780
  * adjusts wiring per handler from a single dropdown of all emitters'
51275
51781
  * (widget × event) pairs.
51276
51782
  */
51277
- function ListenersTab(_ref1) {
51783
+ function ListenersTab(_ref11) {
51278
51784
  var _receivers$;
51279
- var emitters = _ref1.emitters,
51280
- receivers = _ref1.receivers,
51281
- wiring = _ref1.wiring,
51282
- onAdd = _ref1.onAdd,
51283
- onRemove = _ref1.onRemove;
51785
+ var emitters = _ref11.emitters,
51786
+ receivers = _ref11.receivers,
51787
+ wiring = _ref11.wiring,
51788
+ onAdd = _ref11.onAdd,
51789
+ onRemove = _ref11.onRemove;
51284
51790
  var _useConfigTokens6 = useConfigTokens(),
51285
51791
  muted = _useConfigTokens6.muted,
51286
51792
  hairline = _useConfigTokens6.hairline;
51287
- var _useState17 = React.useState(((_receivers$ = receivers[0]) === null || _receivers$ === void 0 ? void 0 : _receivers$.key) || null),
51288
- _useState18 = _slicedToArray(_useState17, 2),
51289
- selectedReceiverKey = _useState18[0],
51290
- setSelectedReceiverKey = _useState18[1];
51291
- var _useState19 = React.useState(null),
51793
+ var _useState19 = React.useState(((_receivers$ = receivers[0]) === null || _receivers$ === void 0 ? void 0 : _receivers$.key) || null),
51292
51794
  _useState20 = _slicedToArray(_useState19, 2),
51293
- selectedHandler = _useState20[0],
51294
- setSelectedHandler = _useState20[1];
51795
+ selectedReceiverKey = _useState20[0],
51796
+ setSelectedReceiverKey = _useState20[1];
51797
+ var _useState21 = React.useState(null),
51798
+ _useState22 = _slicedToArray(_useState21, 2),
51799
+ selectedHandler = _useState22[0],
51800
+ setSelectedHandler = _useState22[1];
51295
51801
 
51296
51802
  // Re-anchor selection if the previously-selected widget disappeared
51297
51803
  // (workspace switched, widget deleted, etc.).
@@ -51307,7 +51813,7 @@ function ListenersTab(_ref1) {
51307
51813
  // Receiver lookup (by composite key) for label resolution in chips.
51308
51814
  var receiverByKey = React.useMemo(function () {
51309
51815
  var m = new Map();
51310
- var _iterator8 = _createForOfIteratorHelper$o(receivers),
51816
+ var _iterator8 = _createForOfIteratorHelper$n(receivers),
51311
51817
  _step8;
51312
51818
  try {
51313
51819
  for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
@@ -51390,14 +51896,14 @@ function ListenersTab(_ref1) {
51390
51896
  * third column. Matches the left-column look from
51391
51897
  * PanelEditItemHandlers.
51392
51898
  */
51393
- function HandlersColumn(_ref11) {
51394
- var receiver = _ref11.receiver,
51395
- myWiring = _ref11.myWiring,
51396
- selectedHandler = _ref11.selectedHandler,
51397
- onSelectHandler = _ref11.onSelectHandler;
51899
+ function HandlersColumn(_ref13) {
51900
+ var receiver = _ref13.receiver,
51901
+ myWiring = _ref13.myWiring,
51902
+ selectedHandler = _ref13.selectedHandler,
51903
+ onSelectHandler = _ref13.onSelectHandler;
51398
51904
  var countsByHandler = React.useMemo(function () {
51399
51905
  var m = new Map();
51400
- var _iterator9 = _createForOfIteratorHelper$o(myWiring),
51906
+ var _iterator9 = _createForOfIteratorHelper$n(myWiring),
51401
51907
  _step9;
51402
51908
  try {
51403
51909
  for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
@@ -51459,13 +51965,13 @@ function HandlersColumn(_ref11) {
51459
51965
  * Checked = wired; toggling commits an add/remove. Mirrors the
51460
51966
  * right-column UX of PanelEditItemHandlers.
51461
51967
  */
51462
- function EventsColumn(_ref12) {
51463
- var receiver = _ref12.receiver,
51464
- handlerName = _ref12.handlerName,
51465
- myWiring = _ref12.myWiring,
51466
- emitters = _ref12.emitters,
51467
- onAdd = _ref12.onAdd,
51468
- onRemove = _ref12.onRemove;
51968
+ function EventsColumn(_ref14) {
51969
+ var receiver = _ref14.receiver,
51970
+ handlerName = _ref14.handlerName,
51971
+ myWiring = _ref14.myWiring,
51972
+ emitters = _ref14.emitters,
51973
+ onAdd = _ref14.onAdd,
51974
+ onRemove = _ref14.onRemove;
51469
51975
  var _useConfigTokens8 = useConfigTokens(),
51470
51976
  muted = _useConfigTokens8.muted,
51471
51977
  hairline = _useConfigTokens8.hairline;
@@ -51474,7 +51980,7 @@ function EventsColumn(_ref12) {
51474
51980
  var wiredHere = React.useMemo(function () {
51475
51981
  var seen = new Set();
51476
51982
  var out = [];
51477
- var _iterator0 = _createForOfIteratorHelper$o(myWiring),
51983
+ var _iterator0 = _createForOfIteratorHelper$n(myWiring),
51478
51984
  _step0;
51479
51985
  try {
51480
51986
  for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
@@ -51551,7 +52057,7 @@ function EventsColumn(_ref12) {
51551
52057
  className: "flex-1 overflow-y-auto p-4 flex flex-col gap-3",
51552
52058
  children: emittersForList.length === 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
51553
52059
  className: "text-sm ".concat(muted),
51554
- children: "No other widgets in this dashboard emit events."
52060
+ children: "Nothing else on this dashboard emits events \u2014 no widgets or bots."
51555
52061
  }) : emittersForList.map(function (e) {
51556
52062
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
51557
52063
  className: "rounded-lg border px-3 py-2 flex flex-col gap-1 ".concat(hairline),
@@ -52529,296 +53035,8 @@ function parseCron(cron) {
52529
53035
  };
52530
53036
  }
52531
53037
 
52532
- function _createForOfIteratorHelper$n(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$n(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
52533
- function _unsupportedIterableToArray$n(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$n(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$n(r, a) : void 0; } }
52534
- function _arrayLikeToArray$n(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
52535
-
52536
- /**
52537
- * @param {Array<object>} workspaces dashboards (each with id, name, layout/pages)
52538
- * @param {(component: string) => object|null} getWidgetConfig
52539
- * @returns {Array<{ workspaceId: string, name: string,
52540
- * widgets: Array<{ ref: string, instanceId: string, label: string, events: string[] }> }>}
52541
- * dashboards with at least one event-emitting widget
52542
- */
52543
- function buildWidgetEventCatalog(workspaces, getWidgetConfig) {
52544
- if (!Array.isArray(workspaces)) return [];
52545
- var out = [];
52546
- var _iterator = _createForOfIteratorHelper$n(workspaces),
52547
- _step;
52548
- try {
52549
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
52550
- var ws = _step.value;
52551
- if (!ws || ws.id === undefined || ws.id === null) continue;
52552
- var widgets = getEmitters(ws, getWidgetConfig).filter(function (e) {
52553
- return e.itemId != null && e.events.length;
52554
- }).map(function (e) {
52555
- return {
52556
- ref: e.component,
52557
- instanceId: String(e.itemId),
52558
- label: e.label || e.component,
52559
- events: e.events
52560
- };
52561
- });
52562
- if (!widgets.length) continue;
52563
- out.push({
52564
- workspaceId: String(ws.id),
52565
- name: ws.name || "Dashboard ".concat(ws.id),
52566
- widgets: widgets
52567
- });
52568
- }
52569
- // Dashboards can share a name (e.g. copies of "Kitchen Sink"); number the
52570
- // duplicates so each picker entry is distinguishable.
52571
- } catch (err) {
52572
- _iterator.e(err);
52573
- } finally {
52574
- _iterator.f();
52575
- }
52576
- var totals = {};
52577
- for (var _i = 0, _out = out; _i < _out.length; _i++) {
52578
- var w = _out[_i];
52579
- totals[w.name] = (totals[w.name] || 0) + 1;
52580
- }
52581
- var seen = {};
52582
- for (var _i2 = 0, _out2 = out; _i2 < _out2.length; _i2++) {
52583
- var _w = _out2[_i2];
52584
- if (totals[_w.name] > 1) {
52585
- seen[_w.name] = (seen[_w.name] || 0) + 1;
52586
- _w.name = "".concat(_w.name, " (").concat(seen[_w.name], ")");
52587
- }
52588
- }
52589
- return out;
52590
- }
52591
-
52592
- /** A subscription to one widget event, picked from the catalog. */
52593
- function widgetSubscription(workspace, widget, event) {
52594
- return {
52595
- eventType: formatEventString(widget.ref, widget.instanceId, event),
52596
- source: {
52597
- kind: "widget",
52598
- ref: widget.ref,
52599
- instanceId: widget.instanceId,
52600
- event: event,
52601
- workspaceId: workspace.workspaceId
52602
- },
52603
- label: "".concat(workspace.name, " \u203A ").concat(widget.label, " \u203A ").concat(event)
52604
- };
52605
- }
52606
-
52607
- /**
52608
- * How to show a saved subscription: its label from the live catalog, and
52609
- * whether its widget/event is gone (`missing`). Subscriptions saved before
52610
- * the picker (bare eventType) get a friendly label when they still resolve;
52611
- * otherwise they show as typed.
52612
- */
52613
- function describeSubscription(sub, catalog) {
52614
- var botCatalog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
52615
- var eventType = sub && sub.eventType;
52616
- // Bot subscriptions resolve against the bot catalog; `kind` lets the form
52617
- // say "bot missing" instead of "widget missing".
52618
- if (sub && sub.source && sub.source.kind === "bot") {
52619
- var _iterator2 = _createForOfIteratorHelper$n(botCatalog || []),
52620
- _step2;
52621
- try {
52622
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
52623
- var b = _step2.value;
52624
- var _iterator3 = _createForOfIteratorHelper$n(b.events),
52625
- _step3;
52626
- try {
52627
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
52628
- var ev = _step3.value;
52629
- var s = botSubscription(b, ev);
52630
- if (s.eventType === eventType) {
52631
- return {
52632
- label: s.label,
52633
- missing: false,
52634
- kind: "bot"
52635
- };
52636
- }
52637
- }
52638
- } catch (err) {
52639
- _iterator3.e(err);
52640
- } finally {
52641
- _iterator3.f();
52642
- }
52643
- }
52644
- } catch (err) {
52645
- _iterator2.e(err);
52646
- } finally {
52647
- _iterator2.f();
52648
- }
52649
- return {
52650
- label: sub.label || eventType,
52651
- missing: true,
52652
- kind: "bot"
52653
- };
52654
- }
52655
- var _iterator4 = _createForOfIteratorHelper$n(catalog || []),
52656
- _step4;
52657
- try {
52658
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
52659
- var ws = _step4.value;
52660
- var _iterator5 = _createForOfIteratorHelper$n(ws.widgets),
52661
- _step5;
52662
- try {
52663
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
52664
- var w = _step5.value;
52665
- var _iterator6 = _createForOfIteratorHelper$n(w.events),
52666
- _step6;
52667
- try {
52668
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
52669
- var _ev = _step6.value;
52670
- if (formatEventString(w.ref, w.instanceId, _ev) === eventType) {
52671
- return {
52672
- label: widgetSubscription(ws, w, _ev).label,
52673
- missing: false
52674
- };
52675
- }
52676
- }
52677
- } catch (err) {
52678
- _iterator6.e(err);
52679
- } finally {
52680
- _iterator6.f();
52681
- }
52682
- }
52683
- } catch (err) {
52684
- _iterator5.e(err);
52685
- } finally {
52686
- _iterator5.f();
52687
- }
52688
- }
52689
- } catch (err) {
52690
- _iterator4.e(err);
52691
- } finally {
52692
- _iterator4.f();
52693
- }
52694
- if (sub && sub.source) {
52695
- return {
52696
- label: sub.label || eventType,
52697
- missing: true
52698
- };
52699
- }
52700
- return {
52701
- label: eventType || "",
52702
- missing: false
52703
- };
52704
- }
52705
-
52706
- /**
52707
- * Events other bots publish (bot:<ref>[<botId>].<event>, PRD US-010), for the
52708
- * "Another bot" side of the picker. Derived from each bot's settings — never
52709
- * hand-declared: Completed, Failed, and one `tool.<providerType>.<tool>` per
52710
- * tool the bot may use (the provider's tools, narrowed by the bot's
52711
- * selection). Providers with no known type or tool list are skipped.
52712
- *
52713
- * @param {Array<object>} bots
52714
- * @param {Array<{name, type, tools}>} toolSources bots.listToolSources()
52715
- * @param {string} [excludeBotId] the bot being edited — can't trigger itself
52716
- */
52717
- function buildBotEventCatalog(bots, toolSources) {
52718
- var excludeBotId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
52719
- if (!Array.isArray(bots)) return [];
52720
- var sources = Array.isArray(toolSources) ? toolSources : [];
52721
- var out = [];
52722
- var _iterator7 = _createForOfIteratorHelper$n(bots),
52723
- _step7;
52724
- try {
52725
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
52726
- var bot = _step7.value;
52727
- if (!bot || !bot.id || !bot.ref || bot.id === excludeBotId) continue;
52728
- var events = [{
52729
- event: "completed",
52730
- label: "Completed"
52731
- }, {
52732
- event: "failed",
52733
- label: "Failed"
52734
- }];
52735
- var _iterator8 = _createForOfIteratorHelper$n(bot.mcpServers || []),
52736
- _step8;
52737
- try {
52738
- var _loop = function _loop() {
52739
- var provider = _step8.value;
52740
- var src = sources.find(function (s) {
52741
- return s && s.name === provider;
52742
- });
52743
- if (!src || !src.type || !Array.isArray(src.tools)) return 1; // continue
52744
- var sel = bot.toolSelections && bot.toolSelections[provider];
52745
- var tools = Array.isArray(sel) ? src.tools.filter(function (t) {
52746
- return sel.includes(t);
52747
- }) : src.tools;
52748
- var _iterator9 = _createForOfIteratorHelper$n(tools),
52749
- _step9;
52750
- try {
52751
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
52752
- var tool = _step9.value;
52753
- events.push({
52754
- event: "tool.".concat(src.type, ".").concat(tool),
52755
- label: "".concat(provider, " \u203A ").concat(tool)
52756
- });
52757
- }
52758
- } catch (err) {
52759
- _iterator9.e(err);
52760
- } finally {
52761
- _iterator9.f();
52762
- }
52763
- };
52764
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
52765
- if (_loop()) continue;
52766
- }
52767
- } catch (err) {
52768
- _iterator8.e(err);
52769
- } finally {
52770
- _iterator8.f();
52771
- }
52772
- out.push({
52773
- botId: bot.id,
52774
- ref: bot.ref,
52775
- name: bot.name || bot.id,
52776
- events: events
52777
- });
52778
- }
52779
- } catch (err) {
52780
- _iterator7.e(err);
52781
- } finally {
52782
- _iterator7.f();
52783
- }
52784
- return out;
52785
- }
52786
-
52787
- /** A subscription to one bot event, picked from the bot catalog. */
52788
- function botSubscription(botEntry, ev) {
52789
- return {
52790
- eventType: "bot:".concat(botEntry.ref, "[").concat(botEntry.botId, "].").concat(ev.event),
52791
- source: {
52792
- kind: "bot",
52793
- ref: botEntry.ref,
52794
- instanceId: botEntry.botId,
52795
- event: ev.event
52796
- },
52797
- label: "".concat(botEntry.name, " \u203A ").concat(ev.label)
52798
- };
52799
- }
52800
-
52801
53038
  function ownKeys$y(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
52802
53039
  function _objectSpread$y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$y(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
52803
- var EVENT_FROM_OPTIONS = [{
52804
- value: "widget",
52805
- label: "A dashboard widget"
52806
- }, {
52807
- value: "bot",
52808
- label: "Another bot"
52809
- }];
52810
-
52811
- /**
52812
- * BotDetail — create/edit form for a Bot Factory bot (Settings → Bots).
52813
- *
52814
- * Built for a non-technical user: Providers (the user's Dash MCP providers —
52815
- * what the bot can use), the AI model, and the schedule are all
52816
- * pick-from-a-list, never free text. "Provider" always means a Dash provider;
52817
- * the LLM choice is labelled "Model source". The raw cron lives behind an "Advanced"
52818
- * toggle for power users. All inputs are @trops/dash-react primitives.
52819
- */
52820
-
52821
- // Friendly, Title-case provider labels for the dropdown.
52822
53040
  var PROVIDER_LABELS = {
52823
53041
  anthropic: "Anthropic",
52824
53042
  openai: "OpenAI",
@@ -53128,19 +53346,15 @@ var BotDetail = function BotDetail(_ref) {
53128
53346
  var eventCatalog = React.useMemo(function () {
53129
53347
  return buildWidgetEventCatalog(workspaces, getWidgetConfig);
53130
53348
  }, [workspaces, getWidgetConfig]);
53131
- var _useState41 = React.useState("widget"),
53132
- _useState42 = _slicedToArray(_useState41, 2),
53133
- pickFrom = _useState42[0],
53134
- setPickFrom = _useState42[1];
53135
53349
  // Team = the dashboard this bot belongs to ("" = Unassigned). A bot on a
53136
53350
  // team only hears its own dashboard's events (bot-teams TEAM-001).
53137
- var _useState43 = React.useState(function () {
53351
+ var _useState41 = React.useState(function () {
53138
53352
  var id = bot ? bot.workspaceId : defaultWorkspaceId;
53139
53353
  return id === undefined || id === null || id === "" ? "" : String(id);
53140
53354
  }),
53141
- _useState44 = _slicedToArray(_useState43, 2),
53142
- team = _useState44[0],
53143
- setTeam = _useState44[1];
53355
+ _useState42 = _slicedToArray(_useState41, 2),
53356
+ team = _useState42[0],
53357
+ setTeam = _useState42[1];
53144
53358
  var teamOptions = React.useMemo(function () {
53145
53359
  return [{
53146
53360
  value: "",
@@ -53148,40 +53362,33 @@ var BotDetail = function BotDetail(_ref) {
53148
53362
  }].concat(_toConsumableArray(dashboardOptions(workspaces)));
53149
53363
  }, [workspaces]);
53150
53364
  var offTeam = offTeamSubscriptions(subscriptions, team);
53151
- // The event picker opens on the bot's own dashboard.
53152
- var _useState45 = React.useState(team),
53365
+ // "Runs when…" (TEAM-012): one picker of everything that can trigger the
53366
+ // bot; a just-added trigger reminds the user to Save.
53367
+ var _useState43 = React.useState(""),
53368
+ _useState44 = _slicedToArray(_useState43, 2),
53369
+ pickTrigger = _useState44[0],
53370
+ setPickTrigger = _useState44[1];
53371
+ var _useState45 = React.useState(false),
53153
53372
  _useState46 = _slicedToArray(_useState45, 2),
53154
- pickWorkspace = _useState46[0],
53155
- setPickWorkspace = _useState46[1];
53156
- var _useState47 = React.useState(""),
53157
- _useState48 = _slicedToArray(_useState47, 2),
53158
- pickWidget = _useState48[0],
53159
- setPickWidget = _useState48[1];
53160
- var _useState49 = React.useState(""),
53161
- _useState50 = _slicedToArray(_useState49, 2),
53162
- pickBot = _useState50[0],
53163
- setPickBot = _useState50[1];
53164
- var _useState51 = React.useState(""),
53165
- _useState52 = _slicedToArray(_useState51, 2),
53166
- pickEvent = _useState52[0],
53167
- setPickEvent = _useState52[1];
53373
+ triggerAdded = _useState46[0],
53374
+ setTriggerAdded = _useState46[1];
53168
53375
  var _ref3 = React.useContext(DashReact.ThemeContext) || {},
53169
53376
  _ref3$currentTheme = _ref3.currentTheme,
53170
53377
  currentTheme = _ref3$currentTheme === void 0 ? {} : _ref3$currentTheme;
53171
53378
  var hairline = currentTheme["border-neutral-dark"] || "border-gray-700";
53172
- var _useState53 = React.useState(false),
53173
- _useState54 = _slicedToArray(_useState53, 2),
53174
- saving = _useState54[0],
53175
- setSaving = _useState54[1];
53176
- var _useState55 = React.useState(null),
53177
- _useState56 = _slicedToArray(_useState55, 2),
53178
- error = _useState56[0],
53179
- setError = _useState56[1];
53379
+ var _useState47 = React.useState(false),
53380
+ _useState48 = _slicedToArray(_useState47, 2),
53381
+ saving = _useState48[0],
53382
+ setSaving = _useState48[1];
53383
+ var _useState49 = React.useState(null),
53384
+ _useState50 = _slicedToArray(_useState49, 2),
53385
+ error = _useState50[0],
53386
+ setError = _useState50[1];
53180
53387
  // "Saved" shows after a successful save until the next edit.
53181
- var _useState57 = React.useState(false),
53182
- _useState58 = _slicedToArray(_useState57, 2),
53183
- justSaved = _useState58[0],
53184
- setJustSaved = _useState58[1];
53388
+ var _useState51 = React.useState(false),
53389
+ _useState52 = _slicedToArray(_useState51, 2),
53390
+ justSaved = _useState52[0],
53391
+ setJustSaved = _useState52[1];
53185
53392
 
53186
53393
  // Unsaved changes: the editable fields now vs. when the form opened (or
53187
53394
  // last saved).
@@ -53204,10 +53411,10 @@ var BotDetail = function BotDetail(_ref) {
53204
53411
  subscriptions: subscriptions,
53205
53412
  team: team
53206
53413
  });
53207
- var _useState59 = React.useState(snapshot),
53208
- _useState60 = _slicedToArray(_useState59, 2),
53209
- baseline = _useState60[0],
53210
- setBaseline = _useState60[1];
53414
+ var _useState53 = React.useState(snapshot),
53415
+ _useState54 = _slicedToArray(_useState53, 2),
53416
+ baseline = _useState54[0],
53417
+ setBaseline = _useState54[1];
53211
53418
  var dirty = snapshot !== baseline;
53212
53419
  React.useEffect(function () {
53213
53420
  if (dirty) setJustSaved(false);
@@ -53367,35 +53574,39 @@ var BotDetail = function BotDetail(_ref) {
53367
53574
  });
53368
53575
  };
53369
53576
 
53370
- // Cascading picker options. A widget's option value is "ref|instanceId".
53371
- var pickedWs = eventCatalog.find(function (w) {
53372
- return w.workspaceId === pickWorkspace;
53373
- });
53374
- var pickedWidget = pickedWs ? pickedWs.widgets.find(function (w) {
53375
- return "".concat(w.ref, "|").concat(w.instanceId) === pickWidget;
53376
- }) : null;
53377
-
53378
- // Other bots' events, derived from their providers + tools (this bot
53379
- // excluded — it can't trigger itself).
53577
+ // Other bots' events (this bot excluded — it can't trigger itself), for
53578
+ // labelling the triggers already on the bot.
53380
53579
  var botCatalog = React.useMemo(function () {
53381
53580
  return buildBotEventCatalog(bots, toolSources, (bot === null || bot === void 0 ? void 0 : bot.id) || null);
53382
53581
  }, [bots, toolSources, bot === null || bot === void 0 ? void 0 : bot.id]);
53383
- var pickedBot = botCatalog.find(function (b) {
53384
- return b.botId === pickBot;
53582
+
53583
+ // Everything that can trigger this bot, grouped (TEAM-012).
53584
+ var triggerOptions = React.useMemo(function () {
53585
+ return buildTriggerOptions({
53586
+ team: team || null,
53587
+ workspaces: workspaces,
53588
+ getWidgetConfig: getWidgetConfig,
53589
+ bots: bots,
53590
+ toolSources: toolSources,
53591
+ botId: (bot === null || bot === void 0 ? void 0 : bot.id) || null,
53592
+ existing: subscriptions.map(function (s) {
53593
+ return s.eventType;
53594
+ })
53595
+ });
53596
+ }, [team, workspaces, getWidgetConfig, bots, toolSources, bot === null || bot === void 0 ? void 0 : bot.id, subscriptions]);
53597
+ var pickedTrigger = triggerOptions.find(function (o) {
53598
+ return o.value === pickTrigger;
53385
53599
  }) || null;
53386
- var pickedBotEvent = pickedBot ? pickedBot.events.find(function (e) {
53387
- return e.event === pickEvent;
53388
- }) || null : null;
53389
- var canAddEvent = pickFrom === "bot" ? !!pickedBotEvent : !!(pickedWidget && pickEvent);
53390
53600
  var addSubscription = function addSubscription() {
53391
- if (!canAddEvent) return;
53392
- var sub = pickFrom === "bot" ? botSubscription(pickedBot, pickedBotEvent) : widgetSubscription(pickedWs, pickedWidget, pickEvent);
53601
+ if (!pickedTrigger) return;
53602
+ var sub = pickedTrigger.subscription;
53393
53603
  setSubscriptions(function (prev) {
53394
53604
  return prev.some(function (s) {
53395
53605
  return s.eventType === sub.eventType;
53396
53606
  }) ? prev : [].concat(_toConsumableArray(prev), [sub]);
53397
53607
  });
53398
- setPickEvent("");
53608
+ setPickTrigger("");
53609
+ setTriggerAdded(true);
53399
53610
  };
53400
53611
  var removeSubscription = function removeSubscription(eventType) {
53401
53612
  setSubscriptions(function (prev) {
@@ -53767,101 +53978,32 @@ var BotDetail = function BotDetail(_ref) {
53767
53978
  }) : /*#__PURE__*/jsxRuntime.jsx("span", {
53768
53979
  className: "text-xs opacity-50",
53769
53980
  children: "This bot doesn't run on any events yet."
53770
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
53771
- label: "From",
53772
- value: pickFrom,
53773
- onChange: function onChange(v) {
53774
- setPickFrom(v);
53775
- setPickEvent("");
53776
- },
53777
- options: EVENT_FROM_OPTIONS
53778
- }), pickFrom === "bot" ? botCatalog.length ? /*#__PURE__*/jsxRuntime.jsxs("div", {
53981
+ }), triggerOptions.length ? /*#__PURE__*/jsxRuntime.jsxs("div", {
53779
53982
  className: "flex flex-col gap-2",
53780
53983
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
53781
- label: "Bot",
53782
- value: pickBot,
53783
- onChange: function onChange(v) {
53784
- setPickBot(v);
53785
- setPickEvent("");
53786
- },
53787
- placeholder: "Choose a bot\u2026",
53788
- options: botCatalog.map(function (b) {
53789
- return {
53790
- value: b.botId,
53791
- label: b.name
53792
- };
53793
- })
53794
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
53795
- label: "Event",
53796
- value: pickEvent,
53797
- onChange: setPickEvent,
53798
- placeholder: "Choose an event\u2026",
53799
- options: (pickedBot ? pickedBot.events : []).map(function (e) {
53984
+ label: "Runs when\u2026",
53985
+ value: pickTrigger,
53986
+ onChange: setPickTrigger,
53987
+ placeholder: "Choose what triggers this bot\u2026",
53988
+ options: triggerOptions.map(function (o) {
53800
53989
  return {
53801
- value: e.event,
53802
- label: e.label
53990
+ value: o.value,
53991
+ label: o.label,
53992
+ group: o.group
53803
53993
  };
53804
53994
  })
53805
53995
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
53806
- title: "Add event",
53996
+ title: "Add trigger",
53807
53997
  onClick: addSubscription,
53808
53998
  size: "sm",
53809
- disabled: !canAddEvent
53810
- })]
53811
- }) : /*#__PURE__*/jsxRuntime.jsx("span", {
53812
- className: "text-xs opacity-50",
53813
- children: "No other bots yet. Create another bot to trigger this one when it finishes or uses a tool."
53814
- }) : eventCatalog.length ? /*#__PURE__*/jsxRuntime.jsxs("div", {
53815
- className: "flex flex-col gap-2",
53816
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
53817
- label: "Dashboard",
53818
- value: pickWorkspace,
53819
- onChange: function onChange(v) {
53820
- setPickWorkspace(v);
53821
- setPickWidget("");
53822
- setPickEvent("");
53823
- },
53824
- placeholder: "Choose a dashboard\u2026",
53825
- options: eventCatalog.map(function (w) {
53826
- return {
53827
- value: w.workspaceId,
53828
- label: w.name
53829
- };
53830
- })
53831
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
53832
- label: "Widget",
53833
- value: pickWidget,
53834
- onChange: function onChange(v) {
53835
- setPickWidget(v);
53836
- setPickEvent("");
53837
- },
53838
- placeholder: "Choose a widget\u2026",
53839
- options: (pickedWs ? pickedWs.widgets : []).map(function (w) {
53840
- return {
53841
- value: "".concat(w.ref, "|").concat(w.instanceId),
53842
- label: w.label
53843
- };
53844
- })
53845
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
53846
- label: "Event",
53847
- value: pickEvent,
53848
- onChange: setPickEvent,
53849
- placeholder: "Choose an event\u2026",
53850
- options: (pickedWidget ? pickedWidget.events : []).map(function (ev) {
53851
- return {
53852
- value: ev,
53853
- label: ev
53854
- };
53855
- })
53856
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
53857
- title: "Add event",
53858
- onClick: addSubscription,
53859
- size: "sm",
53860
- disabled: !pickedWidget || !pickEvent
53861
- })]
53999
+ disabled: !pickedTrigger
54000
+ }), triggerAdded && dirty ? /*#__PURE__*/jsxRuntime.jsx("span", {
54001
+ className: "text-xs opacity-70",
54002
+ children: "Save to keep this trigger."
54003
+ }) : null]
53862
54004
  }) : /*#__PURE__*/jsxRuntime.jsx("span", {
53863
54005
  className: "text-xs opacity-50",
53864
- children: "No widgets on your dashboards publish events yet. Add a widget that publishes events to a dashboard to trigger this bot from it."
54006
+ children: team ? "Nothing can trigger this bot yet. Add a widget that publishes events to this dashboard, or another bot to its team." : "Nothing can trigger this bot yet. Add a widget that publishes events to a dashboard, or create another bot."
53865
54007
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
53866
54008
  className: "text-xs opacity-50",
53867
54009
  children: "The bot runs automatically when one of these events fires."
@@ -70520,6 +70662,11 @@ function pruneListeners(listeners, liveCanonicalKeys) {
70520
70662
  continue;
70521
70663
  }
70522
70664
  var kept = value.filter(function (eventStr) {
70665
+ var _parseEventString;
70666
+ // Bots aren't layout widgets, so they never appear in
70667
+ // liveCanonicalKeys. Their wiring is checked against the bot list
70668
+ // in the Listeners tab instead.
70669
+ if (isBotSource((_parseEventString = parseEventString(eventStr)) === null || _parseEventString === void 0 ? void 0 : _parseEventString.component)) return true;
70523
70670
  var key = eventStringToCanonicalKey(eventStr);
70524
70671
  if (!key) return true; // unparseable — leave alone
70525
70672
  return liveCanonicalKeys.has(key);