@trops/dash-core 0.1.707 → 0.1.708

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import _typeof from '@babel/runtime/helpers/typeof';
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import * as DashReact from '@trops/dash-react';
5
- import { isObject, ThemeContext, FontAwesomeIcon, Modal, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, Tag, Button3, Button2, Paragraph, Sidebar, Panel, Stepper, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorVS, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, ButtonIcon2, DropdownPanel, MenuItem2, useStatusTokens, Caption2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, isHexColor as isHexColor$1, deriveShades, colorTypes, TAILWIND_PALETTE, Toggle, normalizeHex as normalizeHex$1, contrastRatio, Caption, getColorFamilies, getCuratedColorGrid, DashPanel, hexToRgb as hexToRgb$1, themeVariants, SubHeading, Heading2, Paragraph2, Paragraph3, ButtonIcon3, Tag2, Alert, Alert2, Alert3, Toast, Toast2, Toast3, ProgressBar, ProgressBar2, ProgressBar3, MenuItem, Breadcrumbs, Breadcrumbs2, Breadcrumbs3, Caption3, Code, Code2, Code3, Divider, Divider2, Divider3, DashPanel2, DashPanel3, Tabs, Tabs2, Tabs3, Accordion, Accordion2, Accordion3, Toggle2, Toggle3, TextArea, Checkbox, Slider, RadioGroup, AlertBanner, StatusBadge as StatusBadge$1, Skeleton, StatCard, DataList, EmptyState, Card, Panel2, ThemeFromUrlPane, AlgoliaSearchBox, CommandPalette, useSidebar, SectionLabel, CodeEditorInline, Icon2, SegmentedControl, FilterMenu, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
5
+ import { isObject, ThemeContext, FontAwesomeIcon, Modal, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, Tag, Button3, Button2, Paragraph, Sidebar, Panel, Stepper, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorVS, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, ButtonIcon2, DropdownPanel, MenuItem2, useStatusTokens, Caption2, DragComponent, ConfirmationModal, DropComponent, getStyleName, capitalizeFirstLetter, isHexColor as isHexColor$1, deriveShades, colorTypes, TAILWIND_PALETTE, Toggle, normalizeHex as normalizeHex$1, contrastRatio, Caption, getColorFamilies, getCuratedColorGrid, DashPanel, hexToRgb as hexToRgb$1, themeVariants, SubHeading, Heading2, Paragraph2, Paragraph3, ButtonIcon3, Tag2, Alert, Alert2, Alert3, Toast, Toast2, Toast3, ProgressBar, ProgressBar2, ProgressBar3, MenuItem, Breadcrumbs, Breadcrumbs2, Breadcrumbs3, Caption3, Code, Code2, Code3, Divider, Divider2, Divider3, DashPanel2, DashPanel3, Tabs, Tabs2, Tabs3, Accordion, Accordion2, Accordion3, Toggle2, Toggle3, TextArea, Checkbox, Slider, RadioGroup, AlertBanner, StatusBadge as StatusBadge$1, Skeleton, StatCard, DataList, EmptyState, Card, Panel2, ThemeFromUrlPane, AlgoliaSearchBox, CommandPalette, useSidebar, SectionLabel, CodeEditorInline, Icon2, SegmentedControl, useResizableWidth, ResizeHandle, FilterMenu, Navbar, withRouter, Menu as Menu$1 } from '@trops/dash-react';
6
6
  export * from '@trops/dash-react';
7
7
  export { FontAwesomeIcon, ThemeContext } from '@trops/dash-react';
8
8
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
@@ -59130,6 +59130,35 @@ function useNarrow(ref, forced) {
59130
59130
  }, [ref, forced]);
59131
59131
  return typeof forced === "boolean" ? forced : narrow;
59132
59132
  }
59133
+
59134
+ /** The view's content width (px), or 0 until measured. */
59135
+ function useContentWidth(ref) {
59136
+ var _useState3 = useState(0),
59137
+ _useState4 = _slicedToArray(_useState3, 2),
59138
+ width = _useState4[0],
59139
+ setWidth = _useState4[1];
59140
+ useEffect(function () {
59141
+ var el = ref.current;
59142
+ if (!el || typeof ResizeObserver === "undefined") return undefined;
59143
+ var ro = new ResizeObserver(function (_ref3) {
59144
+ var _ref4 = _slicedToArray(_ref3, 1),
59145
+ entry = _ref4[0];
59146
+ setWidth(Math.round(entry.contentRect.width));
59147
+ });
59148
+ ro.observe(el);
59149
+ return function () {
59150
+ return ro.disconnect();
59151
+ };
59152
+ }, [ref]);
59153
+ return width;
59154
+ }
59155
+
59156
+ // The bot panel beside the diagram (TEAM-014): the user drags its edge.
59157
+ // Starts at half; the diagram keeps DIAGRAM_MIN, the panel PANEL_MIN.
59158
+ var PANEL_WIDTH_KEY = "dash:botsView:panelWidth";
59159
+ var PANEL_GAP = 16; // gap-4 between the diagram and the panel
59160
+ var PANEL_MIN = 360;
59161
+ var DIAGRAM_MIN = 320;
59133
59162
  var TABS = ["conversation", "activity", "settings"];
59134
59163
 
59135
59164
  // Diagram / List (TEAM-014), remembered per viewer. Storage can be blocked.
@@ -59148,21 +59177,21 @@ var writeMode = function writeMode(mode) {
59148
59177
  // Not remembered — fine.
59149
59178
  }
59150
59179
  };
59151
- var BotsView = function BotsView(_ref3) {
59152
- var workspace = _ref3.workspace,
59153
- _ref3$workspaces = _ref3.workspaces,
59154
- workspaces = _ref3$workspaces === void 0 ? [] : _ref3$workspaces,
59155
- team = _ref3.team,
59156
- narrow = _ref3.narrow,
59157
- _ref3$focus = _ref3.focus,
59158
- focus = _ref3$focus === void 0 ? null : _ref3$focus,
59159
- _ref3$onDirtyChange = _ref3.onDirtyChange,
59160
- onDirtyChange = _ref3$onDirtyChange === void 0 ? null : _ref3$onDirtyChange,
59161
- _ref3$onOpenSettings = _ref3.onOpenSettings,
59162
- onOpenSettings = _ref3$onOpenSettings === void 0 ? null : _ref3$onOpenSettings;
59163
- var _ref4 = useContext(ThemeContext) || {},
59164
- _ref4$currentTheme = _ref4.currentTheme,
59165
- currentTheme = _ref4$currentTheme === void 0 ? {} : _ref4$currentTheme;
59180
+ var BotsView = function BotsView(_ref5) {
59181
+ var workspace = _ref5.workspace,
59182
+ _ref5$workspaces = _ref5.workspaces,
59183
+ workspaces = _ref5$workspaces === void 0 ? [] : _ref5$workspaces,
59184
+ team = _ref5.team,
59185
+ narrow = _ref5.narrow,
59186
+ _ref5$focus = _ref5.focus,
59187
+ focus = _ref5$focus === void 0 ? null : _ref5$focus,
59188
+ _ref5$onDirtyChange = _ref5.onDirtyChange,
59189
+ onDirtyChange = _ref5$onDirtyChange === void 0 ? null : _ref5$onDirtyChange,
59190
+ _ref5$onOpenSettings = _ref5.onOpenSettings,
59191
+ onOpenSettings = _ref5$onOpenSettings === void 0 ? null : _ref5$onOpenSettings;
59192
+ var _ref6 = useContext(ThemeContext) || {},
59193
+ _ref6$currentTheme = _ref6.currentTheme,
59194
+ currentTheme = _ref6$currentTheme === void 0 ? {} : _ref6$currentTheme;
59166
59195
  var appContext = useContext(AppContext);
59167
59196
  var providers = (appContext === null || appContext === void 0 ? void 0 : appContext.providers) || {};
59168
59197
  var muted = currentTheme["text-neutral-medium"] || "text-gray-400";
@@ -59172,6 +59201,17 @@ var BotsView = function BotsView(_ref3) {
59172
59201
  var strong = currentTheme["text-neutral-light"] || "text-gray-200";
59173
59202
  var rootRef = useRef(null);
59174
59203
  var isNarrow = useNarrow(rootRef, narrow);
59204
+ var contentWidth = useContentWidth(rootRef);
59205
+ var panelRoom = Math.max(0, contentWidth - PANEL_GAP);
59206
+ var _useResizableWidth = useResizableWidth({
59207
+ defaultWidth: Math.round(panelRoom / 2),
59208
+ min: PANEL_MIN,
59209
+ max: panelRoom - DIAGRAM_MIN,
59210
+ edge: "left",
59211
+ storageKey: PANEL_WIDTH_KEY
59212
+ }),
59213
+ panelWidth = _useResizableWidth.width,
59214
+ panelHandle = _useResizableWidth.handleProps;
59175
59215
  var lead = team ? team.lead : null;
59176
59216
  var members = team ? team.members : [];
59177
59217
  var all = [lead].concat(_toConsumableArray(members)).filter(Boolean);
@@ -59179,91 +59219,91 @@ var BotsView = function BotsView(_ref3) {
59179
59219
  var focusTarget = focus && all.some(function (b) {
59180
59220
  return b.id === focus.botId;
59181
59221
  }) ? focus : null;
59182
- var _useState3 = useState(function () {
59222
+ var _useState5 = useState(function () {
59183
59223
  return focusTarget && focusTarget.botId || lead && lead.id || members[0] && members[0].id || null;
59184
59224
  }),
59185
- _useState4 = _slicedToArray(_useState3, 2),
59186
- selectedId = _useState4[0],
59187
- setSelectedId = _useState4[1];
59188
- var _useState5 = useState(function () {
59225
+ _useState6 = _slicedToArray(_useState5, 2),
59226
+ selectedId = _useState6[0],
59227
+ setSelectedId = _useState6[1];
59228
+ var _useState7 = useState(function () {
59189
59229
  return focusTarget && TABS.includes(focusTarget.tab) ? focusTarget.tab : "conversation";
59190
59230
  }),
59191
- _useState6 = _slicedToArray(_useState5, 2),
59192
- tab = _useState6[0],
59193
- setTab = _useState6[1];
59194
- var _useState7 = useState(false),
59195
59231
  _useState8 = _slicedToArray(_useState7, 2),
59196
- menuOpen = _useState8[0],
59197
- setMenuOpen = _useState8[1];
59232
+ tab = _useState8[0],
59233
+ setTab = _useState8[1];
59234
+ var _useState9 = useState(false),
59235
+ _useState0 = _slicedToArray(_useState9, 2),
59236
+ menuOpen = _useState0[0],
59237
+ setMenuOpen = _useState0[1];
59198
59238
  // Team diagram (TEAM-014): the view, and whether the selected bot's
59199
59239
  // Conversation / Activity / Settings is open beside the diagram (else its
59200
59240
  // summary is). A focus request (Open in Bots view) opens it.
59201
- var _useState9 = useState(readMode),
59202
- _useState0 = _slicedToArray(_useState9, 2),
59203
- mode = _useState0[0],
59204
- setModeState = _useState0[1];
59205
- var _useState1 = useState(function () {
59241
+ var _useState1 = useState(readMode),
59242
+ _useState10 = _slicedToArray(_useState1, 2),
59243
+ mode = _useState10[0],
59244
+ setModeState = _useState10[1];
59245
+ var _useState11 = useState(function () {
59206
59246
  return !!focusTarget;
59207
59247
  }),
59208
- _useState10 = _slicedToArray(_useState1, 2),
59209
- detailOpen = _useState10[0],
59210
- setDetailOpen = _useState10[1];
59248
+ _useState12 = _slicedToArray(_useState11, 2),
59249
+ detailOpen = _useState12[0],
59250
+ setDetailOpen = _useState12[1];
59211
59251
  var setMode = function setMode(next) {
59212
59252
  setModeState(next);
59213
59253
  writeMode(next);
59214
59254
  };
59215
59255
  // Team export/import (TEAM-006/007, slice 1): the review being shown, and
59216
59256
  // the last outcome ({ text, details?: string[] }).
59217
- var _useState11 = useState(null),
59218
- _useState12 = _slicedToArray(_useState11, 2),
59219
- importPreview = _useState12[0],
59220
- setImportPreview = _useState12[1];
59221
- var _useState13 = useState(false),
59257
+ var _useState13 = useState(null),
59222
59258
  _useState14 = _slicedToArray(_useState13, 2),
59223
- installing = _useState14[0],
59224
- setInstalling = _useState14[1];
59225
- var _useState15 = useState(null),
59259
+ importPreview = _useState14[0],
59260
+ setImportPreview = _useState14[1];
59261
+ var _useState15 = useState(false),
59226
59262
  _useState16 = _slicedToArray(_useState15, 2),
59227
- importError = _useState16[0],
59228
- setImportError = _useState16[1];
59263
+ installing = _useState16[0],
59264
+ setInstalling = _useState16[1];
59229
59265
  var _useState17 = useState(null),
59230
59266
  _useState18 = _slicedToArray(_useState17, 2),
59231
- teamNote = _useState18[0],
59232
- setTeamNote = _useState18[1];
59233
- // Registry install (TEAM-007 slice 3b): the search panel is open.
59234
- var _useState19 = useState(false),
59267
+ importError = _useState18[0],
59268
+ setImportError = _useState18[1];
59269
+ var _useState19 = useState(null),
59235
59270
  _useState20 = _slicedToArray(_useState19, 2),
59236
- registryOpen = _useState20[0],
59237
- setRegistryOpen = _useState20[1];
59271
+ teamNote = _useState20[0],
59272
+ setTeamNote = _useState20[1];
59273
+ // Registry install (TEAM-007 slice 3b): the search panel is open.
59274
+ var _useState21 = useState(false),
59275
+ _useState22 = _slicedToArray(_useState21, 2),
59276
+ registryOpen = _useState22[0],
59277
+ setRegistryOpen = _useState22[1];
59238
59278
  // Registry publish (TEAM-006 slice 3a): what's being published and how
59239
59279
  // it went.
59240
59280
  var _useRegistryAuthGate = useRegistryAuthGate(),
59241
59281
  ensureAuthed = _useRegistryAuthGate.ensureAuthed,
59242
59282
  authGate = _useRegistryAuthGate.authGate;
59243
- var _useState21 = useState(null),
59244
- _useState22 = _slicedToArray(_useState21, 2),
59245
- publishTarget = _useState22[0],
59246
- setPublishTarget = _useState22[1];
59247
59283
  var _useState23 = useState(null),
59248
59284
  _useState24 = _slicedToArray(_useState23, 2),
59249
- publishPreview = _useState24[0],
59250
- setPublishPreview = _useState24[1];
59251
- var _useState25 = useState(false),
59285
+ publishTarget = _useState24[0],
59286
+ setPublishTarget = _useState24[1];
59287
+ var _useState25 = useState(null),
59252
59288
  _useState26 = _slicedToArray(_useState25, 2),
59253
- publishing = _useState26[0],
59254
- setPublishing = _useState26[1];
59255
- var _useState27 = useState(null),
59289
+ publishPreview = _useState26[0],
59290
+ setPublishPreview = _useState26[1];
59291
+ var _useState27 = useState(false),
59256
59292
  _useState28 = _slicedToArray(_useState27, 2),
59257
- publishResult = _useState28[0],
59258
- setPublishResult = _useState28[1];
59293
+ publishing = _useState28[0],
59294
+ setPublishing = _useState28[1];
59259
59295
  var _useState29 = useState(null),
59260
59296
  _useState30 = _slicedToArray(_useState29, 2),
59261
- publishError = _useState30[0],
59262
- setPublishError = _useState30[1];
59263
- var _useState31 = useState([]),
59297
+ publishResult = _useState30[0],
59298
+ setPublishResult = _useState30[1];
59299
+ var _useState31 = useState(null),
59264
59300
  _useState32 = _slicedToArray(_useState31, 2),
59265
- allBots = _useState32[0],
59266
- setAllBots = _useState32[1];
59301
+ publishError = _useState32[0],
59302
+ setPublishError = _useState32[1];
59303
+ var _useState33 = useState([]),
59304
+ _useState34 = _slicedToArray(_useState33, 2),
59305
+ allBots = _useState34[0],
59306
+ setAllBots = _useState34[1];
59267
59307
  var _nameOf = useMemo(function () {
59268
59308
  var names = new Map(allBots.map(function (b) {
59269
59309
  return [b.id, b.name];
@@ -59283,18 +59323,18 @@ var BotsView = function BotsView(_ref3) {
59283
59323
  if (onDirtyRef.current) onDirtyRef.current(d);
59284
59324
  }, []);
59285
59325
  // Bumped by "Discard changes" to remount the form from the saved bot.
59286
- var _useState33 = useState(0),
59287
- _useState34 = _slicedToArray(_useState33, 2),
59288
- formKey = _useState34[0],
59289
- setFormKey = _useState34[1];
59290
- var _useState35 = useState(null),
59326
+ var _useState35 = useState(0),
59291
59327
  _useState36 = _slicedToArray(_useState35, 2),
59292
- pendingNav = _useState36[0],
59293
- setPendingNav = _useState36[1];
59294
- var _useState37 = useState(false),
59328
+ formKey = _useState36[0],
59329
+ setFormKey = _useState36[1];
59330
+ var _useState37 = useState(null),
59295
59331
  _useState38 = _slicedToArray(_useState37, 2),
59296
- confirmDelete = _useState38[0],
59297
- setConfirmDelete = _useState38[1];
59332
+ pendingNav = _useState38[0],
59333
+ setPendingNav = _useState38[1];
59334
+ var _useState39 = useState(false),
59335
+ _useState40 = _slicedToArray(_useState39, 2),
59336
+ confirmDelete = _useState40[0],
59337
+ setConfirmDelete = _useState40[1];
59298
59338
 
59299
59339
  // All bots (any dashboard) — the form's "Another bot" event source and
59300
59340
  // names for trigger chains. Reloaded when bots change anywhere.
@@ -59315,10 +59355,10 @@ var BotsView = function BotsView(_ref3) {
59315
59355
 
59316
59356
  // Providers' types and tools (TEAM-014): which tool events a bot can
59317
59357
  // trigger others on, in the diagram's trigger popover.
59318
- var _useState39 = useState([]),
59319
- _useState40 = _slicedToArray(_useState39, 2),
59320
- toolSources = _useState40[0],
59321
- setToolSources = _useState40[1];
59358
+ var _useState41 = useState([]),
59359
+ _useState42 = _slicedToArray(_useState41, 2),
59360
+ toolSources = _useState42[0],
59361
+ setToolSources = _useState42[1];
59322
59362
  var workspaceId = workspace ? workspace.id : null;
59323
59363
  useEffect(function () {
59324
59364
  var bots = api$6();
@@ -59444,12 +59484,12 @@ var BotsView = function BotsView(_ref3) {
59444
59484
  }) || null;
59445
59485
  };
59446
59486
  var saveTrigger = /*#__PURE__*/function () {
59447
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref5) {
59487
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref7) {
59448
59488
  var mode, sourceId, targetId, oldEventType, event, label, note, bots, source, target, next;
59449
59489
  return _regeneratorRuntime.wrap(function (_context) {
59450
59490
  while (1) switch (_context.prev = _context.next) {
59451
59491
  case 0:
59452
- mode = _ref5.mode, sourceId = _ref5.sourceId, targetId = _ref5.targetId, oldEventType = _ref5.oldEventType, event = _ref5.event, label = _ref5.label, note = _ref5.note;
59492
+ mode = _ref7.mode, sourceId = _ref7.sourceId, targetId = _ref7.targetId, oldEventType = _ref7.oldEventType, event = _ref7.event, label = _ref7.label, note = _ref7.note;
59453
59493
  bots = api$6();
59454
59494
  source = findBot(sourceId);
59455
59495
  _context.next = 1;
@@ -59477,16 +59517,16 @@ var BotsView = function BotsView(_ref3) {
59477
59517
  }, _callee);
59478
59518
  }));
59479
59519
  return function saveTrigger(_x) {
59480
- return _ref6.apply(this, arguments);
59520
+ return _ref8.apply(this, arguments);
59481
59521
  };
59482
59522
  }();
59483
59523
  var removeTriggerFrom = /*#__PURE__*/function () {
59484
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref7) {
59524
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref9) {
59485
59525
  var targetId, eventType, bots, target;
59486
59526
  return _regeneratorRuntime.wrap(function (_context2) {
59487
59527
  while (1) switch (_context2.prev = _context2.next) {
59488
59528
  case 0:
59489
- targetId = _ref7.targetId, eventType = _ref7.eventType;
59529
+ targetId = _ref9.targetId, eventType = _ref9.eventType;
59490
59530
  bots = api$6();
59491
59531
  _context2.next = 1;
59492
59532
  return latestBot(targetId);
@@ -59512,13 +59552,13 @@ var BotsView = function BotsView(_ref3) {
59512
59552
  }, _callee2);
59513
59553
  }));
59514
59554
  return function removeTriggerFrom(_x2) {
59515
- return _ref8.apply(this, arguments);
59555
+ return _ref0.apply(this, arguments);
59516
59556
  };
59517
59557
  }();
59518
59558
  // The bot as saved right now (the view's copy can be behind a save made
59519
59559
  // elsewhere); falls back to the view's copy.
59520
59560
  var latestBot = /*#__PURE__*/function () {
59521
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
59561
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
59522
59562
  var bots, fresh;
59523
59563
  return _regeneratorRuntime.wrap(function (_context3) {
59524
59564
  while (1) switch (_context3.prev = _context3.next) {
@@ -59548,13 +59588,13 @@ var BotsView = function BotsView(_ref3) {
59548
59588
  }, _callee3);
59549
59589
  }));
59550
59590
  return function latestBot(_x3) {
59551
- return _ref9.apply(this, arguments);
59591
+ return _ref1.apply(this, arguments);
59552
59592
  };
59553
59593
  }();
59554
59594
  var status = selected && team ? team.statusOf(selected.id) : "Idle";
59555
59595
  var statusDot = DOT[status] || DOT.Idle;
59556
59596
  var togglePause = /*#__PURE__*/function () {
59557
- var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
59597
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
59558
59598
  var bots;
59559
59599
  return _regeneratorRuntime.wrap(function (_context4) {
59560
59600
  while (1) switch (_context4.prev = _context4.next) {
@@ -59587,13 +59627,13 @@ var BotsView = function BotsView(_ref3) {
59587
59627
  }, _callee4);
59588
59628
  }));
59589
59629
  return function togglePause() {
59590
- return _ref0.apply(this, arguments);
59630
+ return _ref10.apply(this, arguments);
59591
59631
  };
59592
59632
  }();
59593
59633
 
59594
59634
  // Place a bot widget on this dashboard (TEAM-012) and say how it went.
59595
59635
  var showOnDashboard = /*#__PURE__*/function () {
59596
- var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(kind) {
59636
+ var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(kind) {
59597
59637
  var bot,
59598
59638
  bots,
59599
59639
  r,
@@ -59637,11 +59677,11 @@ var BotsView = function BotsView(_ref3) {
59637
59677
  }, _callee5);
59638
59678
  }));
59639
59679
  return function showOnDashboard(_x4) {
59640
- return _ref1.apply(this, arguments);
59680
+ return _ref11.apply(this, arguments);
59641
59681
  };
59642
59682
  }();
59643
59683
  var saveBot = /*#__PURE__*/function () {
59644
- var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(definition) {
59684
+ var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(definition) {
59645
59685
  var opts,
59646
59686
  bots,
59647
59687
  saved,
@@ -59684,21 +59724,21 @@ var BotsView = function BotsView(_ref3) {
59684
59724
  }, _callee6);
59685
59725
  }));
59686
59726
  return function saveBot(_x5) {
59687
- return _ref10.apply(this, arguments);
59727
+ return _ref12.apply(this, arguments);
59688
59728
  };
59689
59729
  }();
59690
59730
 
59691
59731
  // Discarding a draft (row ×, the draft form's button, its banner) asks
59692
59732
  // first; the lead can draft it again if asked.
59693
- var _useState41 = useState(null),
59694
- _useState42 = _slicedToArray(_useState41, 2),
59695
- discardTarget = _useState42[0],
59696
- setDiscardTarget = _useState42[1];
59733
+ var _useState43 = useState(null),
59734
+ _useState44 = _slicedToArray(_useState43, 2),
59735
+ discardTarget = _useState44[0],
59736
+ setDiscardTarget = _useState44[1];
59697
59737
  var discardDraft = function discardDraft() {
59698
59738
  if (selectedDraft) setDiscardTarget(selectedDraft);
59699
59739
  };
59700
59740
  var confirmDiscardDraft = /*#__PURE__*/function () {
59701
- var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
59741
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
59702
59742
  var d;
59703
59743
  return _regeneratorRuntime.wrap(function (_context7) {
59704
59744
  while (1) switch (_context7.prev = _context7.next) {
@@ -59727,7 +59767,7 @@ var BotsView = function BotsView(_ref3) {
59727
59767
  }, _callee7);
59728
59768
  }));
59729
59769
  return function confirmDiscardDraft() {
59730
- return _ref11.apply(this, arguments);
59770
+ return _ref13.apply(this, arguments);
59731
59771
  };
59732
59772
  }();
59733
59773
  var draftRow = function draftRow(d) {
@@ -59761,7 +59801,7 @@ var BotsView = function BotsView(_ref3) {
59761
59801
  }, id);
59762
59802
  };
59763
59803
  var removeFromTeam = /*#__PURE__*/function () {
59764
- var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
59804
+ var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
59765
59805
  var bots;
59766
59806
  return _regeneratorRuntime.wrap(function (_context8) {
59767
59807
  while (1) switch (_context8.prev = _context8.next) {
@@ -59787,11 +59827,11 @@ var BotsView = function BotsView(_ref3) {
59787
59827
  }, _callee8);
59788
59828
  }));
59789
59829
  return function removeFromTeam() {
59790
- return _ref12.apply(this, arguments);
59830
+ return _ref14.apply(this, arguments);
59791
59831
  };
59792
59832
  }();
59793
59833
  var deleteBot = /*#__PURE__*/function () {
59794
- var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
59834
+ var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
59795
59835
  var bots;
59796
59836
  return _regeneratorRuntime.wrap(function (_context9) {
59797
59837
  while (1) switch (_context9.prev = _context9.next) {
@@ -59816,14 +59856,14 @@ var BotsView = function BotsView(_ref3) {
59816
59856
  }, _callee9);
59817
59857
  }));
59818
59858
  return function deleteBot() {
59819
- return _ref13.apply(this, arguments);
59859
+ return _ref15.apply(this, arguments);
59820
59860
  };
59821
59861
  }();
59822
59862
 
59823
59863
  // ─── Team export/import (TEAM-006/007, slice 1) ───────────────────
59824
59864
 
59825
59865
  var exportTeam = /*#__PURE__*/function () {
59826
- var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
59866
+ var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0() {
59827
59867
  var bots, r, file, _t2;
59828
59868
  return _regeneratorRuntime.wrap(function (_context0) {
59829
59869
  while (1) switch (_context0.prev = _context0.next) {
@@ -59866,7 +59906,7 @@ var BotsView = function BotsView(_ref3) {
59866
59906
  }, _callee0);
59867
59907
  }));
59868
59908
  return function exportTeam() {
59869
- return _ref14.apply(this, arguments);
59909
+ return _ref16.apply(this, arguments);
59870
59910
  };
59871
59911
  }();
59872
59912
  var importTeam = function importTeam() {
@@ -59931,7 +59971,7 @@ var BotsView = function BotsView(_ref3) {
59931
59971
  // A registry package was picked: download, verify and check it in the
59932
59972
  // main process, then review it like an imported file.
59933
59973
  var pickRegistryPackage = /*#__PURE__*/function () {
59934
- var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(ref) {
59974
+ var _ref18 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(ref) {
59935
59975
  var bots, r, signedIn, _t4, _t5;
59936
59976
  return _regeneratorRuntime.wrap(function (_context10) {
59937
59977
  while (1) switch (_context10.prev = _context10.next) {
@@ -60002,11 +60042,11 @@ var BotsView = function BotsView(_ref3) {
60002
60042
  }, _callee10);
60003
60043
  }));
60004
60044
  return function pickRegistryPackage(_x6) {
60005
- return _ref16.apply(this, arguments);
60045
+ return _ref18.apply(this, arguments);
60006
60046
  };
60007
60047
  }();
60008
60048
  var installTeam = /*#__PURE__*/function () {
60009
- var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(choices) {
60049
+ var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(choices) {
60010
60050
  var roles,
60011
60051
  bots,
60012
60052
  r,
@@ -60075,11 +60115,11 @@ var BotsView = function BotsView(_ref3) {
60075
60115
  }, _callee11, null, [[2,, 9, 10]]);
60076
60116
  }));
60077
60117
  return function installTeam(_x7) {
60078
- return _ref17.apply(this, arguments);
60118
+ return _ref19.apply(this, arguments);
60079
60119
  };
60080
60120
  }();
60081
60121
  var openPublish = /*#__PURE__*/function () {
60082
- var _ref18 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(kind) {
60122
+ var _ref20 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(kind) {
60083
60123
  var bots, signedIn, target, preview, _t8;
60084
60124
  return _regeneratorRuntime.wrap(function (_context12) {
60085
60125
  while (1) switch (_context12.prev = _context12.next) {
@@ -60143,11 +60183,11 @@ var BotsView = function BotsView(_ref3) {
60143
60183
  }, _callee12);
60144
60184
  }));
60145
60185
  return function openPublish(_x8) {
60146
- return _ref18.apply(this, arguments);
60186
+ return _ref20.apply(this, arguments);
60147
60187
  };
60148
60188
  }();
60149
60189
  var doPublish = /*#__PURE__*/function () {
60150
- var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(meta) {
60190
+ var _ref21 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(meta) {
60151
60191
  var bots, r, _t9;
60152
60192
  return _regeneratorRuntime.wrap(function (_context13) {
60153
60193
  while (1) switch (_context13.prev = _context13.next) {
@@ -60192,7 +60232,7 @@ var BotsView = function BotsView(_ref3) {
60192
60232
  }, _callee13, null, [[2,, 5, 6]]);
60193
60233
  }));
60194
60234
  return function doPublish(_x9) {
60195
- return _ref19.apply(this, arguments);
60235
+ return _ref21.apply(this, arguments);
60196
60236
  };
60197
60237
  }();
60198
60238
  var closePublish = function closePublish() {
@@ -60246,7 +60286,7 @@ var BotsView = function BotsView(_ref3) {
60246
60286
  }) : null]
60247
60287
  });
60248
60288
  var turnOffLead = /*#__PURE__*/function () {
60249
- var _ref20 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
60289
+ var _ref22 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
60250
60290
  var bots;
60251
60291
  return _regeneratorRuntime.wrap(function (_context14) {
60252
60292
  while (1) switch (_context14.prev = _context14.next) {
@@ -60270,11 +60310,11 @@ var BotsView = function BotsView(_ref3) {
60270
60310
  }, _callee14);
60271
60311
  }));
60272
60312
  return function turnOffLead() {
60273
- return _ref20.apply(this, arguments);
60313
+ return _ref22.apply(this, arguments);
60274
60314
  };
60275
60315
  }();
60276
60316
  var turnOnLead = /*#__PURE__*/function () {
60277
- var _ref21 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
60317
+ var _ref23 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
60278
60318
  var bots;
60279
60319
  return _regeneratorRuntime.wrap(function (_context15) {
60280
60320
  while (1) switch (_context15.prev = _context15.next) {
@@ -60297,7 +60337,7 @@ var BotsView = function BotsView(_ref3) {
60297
60337
  }, _callee15);
60298
60338
  }));
60299
60339
  return function turnOnLead() {
60300
- return _ref21.apply(this, arguments);
60340
+ return _ref23.apply(this, arguments);
60301
60341
  };
60302
60342
  }();
60303
60343
  var row = function row(b) {
@@ -60460,6 +60500,9 @@ var BotsView = function BotsView(_ref3) {
60460
60500
  // The diagram with the summary / bot detail beside it (wide windows only;
60461
60501
  // narrow windows keep the bot picker).
60462
60502
  var sideBySide = diagramMode && !isNarrow;
60503
+ // Its width is the user's once the view has been measured and has room
60504
+ // for both minimums.
60505
+ var resizable = sideBySide && panelRoom >= PANEL_MIN + DIAGRAM_MIN;
60463
60506
  var picker = /*#__PURE__*/jsx("div", {
60464
60507
  className: "flex flex-row items-end gap-2",
60465
60508
  children: /*#__PURE__*/jsx("div", {
@@ -60524,163 +60567,179 @@ var BotsView = function BotsView(_ref3) {
60524
60567
  },
60525
60568
  onRunNow: runNow
60526
60569
  })
60527
- }) : /*#__PURE__*/jsxs("section", {
60528
- "aria-label": "Selected bot",
60529
- className: "".concat(sideBySide ? "w-1/2 flex-shrink-0" : "flex-1", " min-w-0 min-h-0 flex flex-col rounded-xl border ").concat(hairline),
60530
- children: [/*#__PURE__*/jsxs("div", {
60531
- className: "flex flex-row items-start justify-between gap-4 px-5 pt-4",
60570
+ }) : /*#__PURE__*/jsxs(Fragment, {
60571
+ children: [resizable ?
60572
+ /*#__PURE__*/
60573
+ // Sits in the gap: the negative margins keep the gap 16px.
60574
+ jsx("div", {
60575
+ className: "flex flex-row",
60576
+ style: {
60577
+ margin: "0 -12px"
60578
+ },
60579
+ children: /*#__PURE__*/jsx(ResizeHandle, _objectSpread$u(_objectSpread$u({}, panelHandle), {}, {
60580
+ ariaLabel: "Resize bot panel"
60581
+ }))
60582
+ }) : null, /*#__PURE__*/jsxs("section", {
60583
+ "aria-label": "Selected bot",
60584
+ className: "".concat(resizable ? "flex-shrink-0" : sideBySide ? "w-1/2 flex-shrink-0" : "flex-1", " min-w-0 min-h-0 flex flex-col rounded-xl border ").concat(hairline),
60585
+ style: resizable ? {
60586
+ width: panelWidth
60587
+ } : undefined,
60532
60588
  children: [/*#__PURE__*/jsxs("div", {
60533
- className: "min-w-0",
60589
+ className: "flex flex-row items-start justify-between gap-4 px-5 pt-4",
60534
60590
  children: [/*#__PURE__*/jsxs("div", {
60535
- className: "flex flex-row items-center gap-2",
60536
- children: [/*#__PURE__*/jsx("h2", {
60537
- className: "text-lg font-semibold truncate",
60538
- children: selected ? selected.name : selectedDraft ? selectedDraft.definition.name : "New bot"
60539
- }), selected ? /*#__PURE__*/jsxs("span", {
60540
- className: "flex flex-row items-center gap-1.5 text-xs ".concat(muted),
60541
- children: [/*#__PURE__*/jsx("span", {
60542
- className: "h-2 w-2 rounded-full ".concat(statusDot)
60543
- }), status]
60591
+ className: "min-w-0",
60592
+ children: [/*#__PURE__*/jsxs("div", {
60593
+ className: "flex flex-row items-center gap-2",
60594
+ children: [/*#__PURE__*/jsx("h2", {
60595
+ className: "text-lg font-semibold truncate",
60596
+ children: selected ? selected.name : selectedDraft ? selectedDraft.definition.name : "New bot"
60597
+ }), selected ? /*#__PURE__*/jsxs("span", {
60598
+ className: "flex flex-row items-center gap-1.5 text-xs ".concat(muted),
60599
+ children: [/*#__PURE__*/jsx("span", {
60600
+ className: "h-2 w-2 rounded-full ".concat(statusDot)
60601
+ }), status]
60602
+ }) : null]
60603
+ }), /*#__PURE__*/jsx("div", {
60604
+ className: "text-sm ".concat(muted),
60605
+ children: selected ? isLead ? "Answers questions about this team · costs nothing until asked" : [(selected.mcpServers || []).join(", "), triggerSummary(selected), selected.installedFrom ? "From ".concat(selected.installedFrom["package"], " v").concat(selected.installedFrom.version) : null].filter(Boolean).join(" · ") : "Joins the ".concat(workspace ? workspace.name : "dashboard", " team")
60606
+ })]
60607
+ }), selected ? /*#__PURE__*/jsxs("div", {
60608
+ className: "flex flex-row items-center gap-2 flex-shrink-0",
60609
+ children: [!isLead ? /*#__PURE__*/jsx(Button2, {
60610
+ title: "Run now",
60611
+ size: "sm",
60612
+ onClick: runNow
60613
+ }) : null, !isLead ? /*#__PURE__*/jsx(Button3, {
60614
+ title: status === "Paused" ? "Resume" : "Pause",
60615
+ size: "sm",
60616
+ onClick: togglePause
60617
+ }) : null, /*#__PURE__*/jsx(Button3, {
60618
+ title: "\u22EF",
60619
+ size: "sm",
60620
+ ariaLabel: "More actions",
60621
+ onClick: function onClick() {
60622
+ return setMenuOpen(function (v) {
60623
+ return !v;
60624
+ });
60625
+ }
60626
+ }), sideBySide ? /*#__PURE__*/jsx(ButtonIcon, {
60627
+ icon: "xmark",
60628
+ size: "sm",
60629
+ ariaLabel: "Back to summary",
60630
+ onClick: closeDetail
60544
60631
  }) : null]
60545
- }), /*#__PURE__*/jsx("div", {
60546
- className: "text-sm ".concat(muted),
60547
- children: selected ? isLead ? "Answers questions about this team · costs nothing until asked" : [(selected.mcpServers || []).join(", "), triggerSummary(selected), selected.installedFrom ? "From ".concat(selected.installedFrom["package"], " v").concat(selected.installedFrom.version) : null].filter(Boolean).join(" · ") : "Joins the ".concat(workspace ? workspace.name : "dashboard", " team")
60548
- })]
60549
- }), selected ? /*#__PURE__*/jsxs("div", {
60550
- className: "flex flex-row items-center gap-2 flex-shrink-0",
60551
- children: [!isLead ? /*#__PURE__*/jsx(Button2, {
60552
- title: "Run now",
60553
- size: "sm",
60554
- onClick: runNow
60555
- }) : null, !isLead ? /*#__PURE__*/jsx(Button3, {
60556
- title: status === "Paused" ? "Resume" : "Pause",
60557
- size: "sm",
60558
- onClick: togglePause
60559
- }) : null, /*#__PURE__*/jsx(Button3, {
60560
- title: "\u22EF",
60561
- size: "sm",
60562
- ariaLabel: "More actions",
60563
- onClick: function onClick() {
60564
- return setMenuOpen(function (v) {
60565
- return !v;
60566
- });
60567
- }
60568
- }), sideBySide ? /*#__PURE__*/jsx(ButtonIcon, {
60632
+ }) : sideBySide ? /*#__PURE__*/jsx(ButtonIcon, {
60569
60633
  icon: "xmark",
60570
60634
  size: "sm",
60571
- ariaLabel: "Back to summary",
60635
+ ariaLabel: "Close",
60572
60636
  onClick: closeDetail
60573
60637
  }) : null]
60574
- }) : sideBySide ? /*#__PURE__*/jsx(ButtonIcon, {
60575
- icon: "xmark",
60576
- size: "sm",
60577
- ariaLabel: "Close",
60578
- onClick: closeDetail
60579
- }) : null]
60580
- }), menuOpen && selected ? /*#__PURE__*/jsx("div", {
60581
- className: "flex flex-row justify-end gap-2 px-5 pt-2",
60582
- children: isLead ? /*#__PURE__*/jsx(Button3, {
60583
- title: "Turn off lead",
60584
- size: "xs",
60585
- onClick: turnOffLead
60586
- }) : /*#__PURE__*/jsxs(Fragment, {
60587
- children: [/*#__PURE__*/jsx(Button3, {
60588
- title: "Show on dashboard",
60638
+ }), menuOpen && selected ? /*#__PURE__*/jsx("div", {
60639
+ className: "flex flex-row justify-end gap-2 px-5 pt-2",
60640
+ children: isLead ? /*#__PURE__*/jsx(Button3, {
60641
+ title: "Turn off lead",
60589
60642
  size: "xs",
60590
- onClick: function onClick() {
60591
- return showOnDashboard("results", selected);
60592
- }
60593
- }), /*#__PURE__*/jsx(Button3, {
60594
- title: "Publish bot\u2026",
60595
- size: "xs",
60596
- onClick: function onClick() {
60597
- return openPublish("bot");
60598
- }
60599
- }), /*#__PURE__*/jsx(Button3, {
60600
- title: "Remove from team",
60601
- size: "xs",
60602
- onClick: removeFromTeam
60603
- }), /*#__PURE__*/jsx(Button3, {
60604
- title: "Delete",
60605
- size: "xs",
60606
- onClick: function onClick() {
60607
- return setConfirmDelete(true);
60608
- }
60609
- })]
60610
- })
60611
- }) : null, /*#__PURE__*/jsx("div", {
60612
- role: "tablist",
60613
- className: "flex flex-row gap-6 px-5 mt-3 border-b ".concat(hairline),
60614
- children: tabs.map(function (_ref22) {
60615
- var _ref23 = _slicedToArray(_ref22, 2),
60616
- id = _ref23[0],
60617
- label = _ref23[1];
60618
- return /*#__PURE__*/jsx("button", {
60619
- type: "button",
60620
- role: "tab",
60621
- "aria-selected": tab === id,
60622
- onClick: function onClick() {
60623
- return switchTab(id);
60624
- },
60625
- className: "py-2.5 text-sm font-medium -mb-px border-b-2 ".concat(tab === id ? "border-indigo-400" : "border-transparent ".concat(muted)),
60626
- children: label
60627
- }, id);
60628
- })
60629
- }), /*#__PURE__*/jsxs("div", {
60630
- className: "flex-1 min-h-0 flex flex-col",
60631
- children: [tab === "conversation" && selected ? /*#__PURE__*/jsx(BotChat, {
60632
- bot: selected,
60633
- isLead: isLead,
60634
- approvals: team ? team.approvalsFor(selected.id) : [],
60635
- onApprove: team ? team.approve : null,
60636
- nameOf: _nameOf,
60637
- onOpenSettings: onOpenSettings,
60638
- onChangeModel: function onChangeModel() {
60639
- return switchTab("settings");
60640
- },
60641
- drafts: isLead ? drafts : undefined,
60642
- onOpenDraft: isLead ? function (id) {
60643
- return select(DRAFT_PREFIX + id);
60644
- } : null
60645
- }) : null, tab === "activity" && selected ? /*#__PURE__*/jsx(BotRunHistory, {
60646
- bot: selected,
60647
- isLead: isLead,
60648
- nameOf: _nameOf,
60649
- onOpenSettings: onOpenSettings,
60650
- onChangeModel: function onChangeModel() {
60651
- return switchTab("settings");
60652
- }
60653
- }) : null, tab === "settings" ? /*#__PURE__*/jsx("div", {
60643
+ onClick: turnOffLead
60644
+ }) : /*#__PURE__*/jsxs(Fragment, {
60645
+ children: [/*#__PURE__*/jsx(Button3, {
60646
+ title: "Show on dashboard",
60647
+ size: "xs",
60648
+ onClick: function onClick() {
60649
+ return showOnDashboard("results", selected);
60650
+ }
60651
+ }), /*#__PURE__*/jsx(Button3, {
60652
+ title: "Publish bot\u2026",
60653
+ size: "xs",
60654
+ onClick: function onClick() {
60655
+ return openPublish("bot");
60656
+ }
60657
+ }), /*#__PURE__*/jsx(Button3, {
60658
+ title: "Remove from team",
60659
+ size: "xs",
60660
+ onClick: removeFromTeam
60661
+ }), /*#__PURE__*/jsx(Button3, {
60662
+ title: "Delete",
60663
+ size: "xs",
60664
+ onClick: function onClick() {
60665
+ return setConfirmDelete(true);
60666
+ }
60667
+ })]
60668
+ })
60669
+ }) : null, /*#__PURE__*/jsx("div", {
60670
+ role: "tablist",
60671
+ className: "flex flex-row gap-6 px-5 mt-3 border-b ".concat(hairline),
60672
+ children: tabs.map(function (_ref24) {
60673
+ var _ref25 = _slicedToArray(_ref24, 2),
60674
+ id = _ref25[0],
60675
+ label = _ref25[1];
60676
+ return /*#__PURE__*/jsx("button", {
60677
+ type: "button",
60678
+ role: "tab",
60679
+ "aria-selected": tab === id,
60680
+ onClick: function onClick() {
60681
+ return switchTab(id);
60682
+ },
60683
+ className: "py-2.5 text-sm font-medium -mb-px border-b-2 ".concat(tab === id ? "border-indigo-400" : "border-transparent ".concat(muted)),
60684
+ children: label
60685
+ }, id);
60686
+ })
60687
+ }), /*#__PURE__*/jsxs("div", {
60654
60688
  className: "flex-1 min-h-0 flex flex-col",
60655
- children: /*#__PURE__*/jsx(BotDetail
60656
- // The lead's banner scrolls with the form (not pinned).
60657
- , {
60658
- header: selectedDraft ? /*#__PURE__*/jsx(DraftBanner, {
60659
- draft: selectedDraft,
60660
- onDiscard: discardDraft,
60661
- onOpenSettings: onOpenSettings
60662
- }) : null,
60663
- bot: selected || selectedDraft && selectedDraft.definition || null,
60664
- isCreating: !selected,
60665
- suggestions: selectedDraft ? selectedDraft.suggestions : null,
60666
- gaps: selectedDraft ? selectedDraft.gaps : null,
60667
- defaultWorkspaceId: workspace ? workspace.id : null,
60668
- providers: providers,
60669
- workspaces: workspaces,
60670
- getWidgetConfig: getWidgetConfig$4,
60671
- bots: allBots,
60672
- onSave: saveBot,
60673
- canShowOnDashboard: !!workspace,
60674
- onDirtyChange: setDirty,
60675
- onDiscardDraft: selectedDraft ? discardDraft : null,
60676
- onDiscard: function onDiscard() {
60677
- setDirty(false);
60678
- setFormKey(function (k) {
60679
- return k + 1;
60680
- });
60689
+ children: [tab === "conversation" && selected ? /*#__PURE__*/jsx(BotChat, {
60690
+ bot: selected,
60691
+ isLead: isLead,
60692
+ approvals: team ? team.approvalsFor(selected.id) : [],
60693
+ onApprove: team ? team.approve : null,
60694
+ nameOf: _nameOf,
60695
+ onOpenSettings: onOpenSettings,
60696
+ onChangeModel: function onChangeModel() {
60697
+ return switchTab("settings");
60698
+ },
60699
+ drafts: isLead ? drafts : undefined,
60700
+ onOpenDraft: isLead ? function (id) {
60701
+ return select(DRAFT_PREFIX + id);
60702
+ } : null
60703
+ }) : null, tab === "activity" && selected ? /*#__PURE__*/jsx(BotRunHistory, {
60704
+ bot: selected,
60705
+ isLead: isLead,
60706
+ nameOf: _nameOf,
60707
+ onOpenSettings: onOpenSettings,
60708
+ onChangeModel: function onChangeModel() {
60709
+ return switchTab("settings");
60681
60710
  }
60682
- }, "".concat(selected ? selected.id : selectedId || NEW_BOT, "-").concat(formKey))
60683
- }) : null]
60711
+ }) : null, tab === "settings" ? /*#__PURE__*/jsx("div", {
60712
+ className: "flex-1 min-h-0 flex flex-col",
60713
+ children: /*#__PURE__*/jsx(BotDetail
60714
+ // The lead's banner scrolls with the form (not pinned).
60715
+ , {
60716
+ header: selectedDraft ? /*#__PURE__*/jsx(DraftBanner, {
60717
+ draft: selectedDraft,
60718
+ onDiscard: discardDraft,
60719
+ onOpenSettings: onOpenSettings
60720
+ }) : null,
60721
+ bot: selected || selectedDraft && selectedDraft.definition || null,
60722
+ isCreating: !selected,
60723
+ suggestions: selectedDraft ? selectedDraft.suggestions : null,
60724
+ gaps: selectedDraft ? selectedDraft.gaps : null,
60725
+ defaultWorkspaceId: workspace ? workspace.id : null,
60726
+ providers: providers,
60727
+ workspaces: workspaces,
60728
+ getWidgetConfig: getWidgetConfig$4,
60729
+ bots: allBots,
60730
+ onSave: saveBot,
60731
+ canShowOnDashboard: !!workspace,
60732
+ onDirtyChange: setDirty,
60733
+ onDiscardDraft: selectedDraft ? discardDraft : null,
60734
+ onDiscard: function onDiscard() {
60735
+ setDirty(false);
60736
+ setFormKey(function (k) {
60737
+ return k + 1;
60738
+ });
60739
+ }
60740
+ }, "".concat(selected ? selected.id : selectedId || NEW_BOT, "-").concat(formKey))
60741
+ }) : null]
60742
+ })]
60684
60743
  })]
60685
60744
  }), /*#__PURE__*/jsx(ConfirmationModal, {
60686
60745
  isOpen: !!pendingNav,