@trops/dash-core 0.1.625 → 0.1.626

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
@@ -47107,9 +47107,212 @@ var ProvidersSection = function ProvidersSection(_ref) {
47107
47107
  });
47108
47108
  };
47109
47109
 
47110
+ /**
47111
+ * cronBuilder.js — turn friendly schedule dropdowns into a cron expression and
47112
+ * back, so a non-technical user never has to type cron. Pure (no React / no
47113
+ * Electron) and unit-tested.
47114
+ *
47115
+ * Supported frequencies map to a 5-field cron (`min hour dom month dow`):
47116
+ * off → "" (no schedule)
47117
+ * hourly → "0 * * * *" (top of every hour)
47118
+ * daily → "m h * * *"
47119
+ * weekday → "m h * * 1-5" (Mon–Fri)
47120
+ * weekly → "m h * * <dow>"
47121
+ * monthly → "m h <dom> * *"
47122
+ *
47123
+ * `parseCron` round-trips a cron we generated back to dropdown state, and falls
47124
+ * back to `{ frequency: "custom" }` for anything hand-written — the form then
47125
+ * shows the raw cron in its Advanced field.
47126
+ */
47127
+
47128
+ var FREQUENCIES = [{
47129
+ value: "off",
47130
+ label: "Off — run manually only"
47131
+ }, {
47132
+ value: "hourly",
47133
+ label: "Every hour"
47134
+ }, {
47135
+ value: "daily",
47136
+ label: "Every day"
47137
+ }, {
47138
+ value: "weekday",
47139
+ label: "Every weekday (Mon–Fri)"
47140
+ }, {
47141
+ value: "weekly",
47142
+ label: "Every week"
47143
+ }, {
47144
+ value: "monthly",
47145
+ label: "Every month"
47146
+ }];
47147
+
47148
+ // cron day-of-week: 0 = Sunday … 6 = Saturday. Monday-first for display.
47149
+ var DAYS_OF_WEEK = [{
47150
+ value: "1",
47151
+ label: "Monday"
47152
+ }, {
47153
+ value: "2",
47154
+ label: "Tuesday"
47155
+ }, {
47156
+ value: "3",
47157
+ label: "Wednesday"
47158
+ }, {
47159
+ value: "4",
47160
+ label: "Thursday"
47161
+ }, {
47162
+ value: "5",
47163
+ label: "Friday"
47164
+ }, {
47165
+ value: "6",
47166
+ label: "Saturday"
47167
+ }, {
47168
+ value: "0",
47169
+ label: "Sunday"
47170
+ }];
47171
+ function ordinal(n) {
47172
+ var s = ["th", "st", "nd", "rd"];
47173
+ var v = n % 100;
47174
+ return n + (s[(v - 20) % 10] || s[v] || s[0]);
47175
+ }
47176
+
47177
+ // Days 1–28 only, so "monthly on the Nth" is valid in every month.
47178
+ var DAYS_OF_MONTH = Array.from({
47179
+ length: 28
47180
+ }, function (_, i) {
47181
+ return {
47182
+ value: String(i + 1),
47183
+ label: ordinal(i + 1)
47184
+ };
47185
+ });
47186
+ function label12(h, m) {
47187
+ var ampm = h < 12 ? "AM" : "PM";
47188
+ var hh = h % 12;
47189
+ if (hh === 0) hh = 12;
47190
+ return "".concat(hh, ":").concat(String(m).padStart(2, "0"), " ").concat(ampm);
47191
+ }
47192
+
47193
+ // Half-hour increments across the day: value "HH:MM" (24h), label "h:MM AM/PM".
47194
+ var TIME_OPTIONS = function () {
47195
+ var opts = [];
47196
+ for (var h = 0; h < 24; h++) {
47197
+ for (var _i = 0, _arr = [0, 30]; _i < _arr.length; _i++) {
47198
+ var m = _arr[_i];
47199
+ opts.push({
47200
+ value: "".concat(String(h).padStart(2, "0"), ":").concat(String(m).padStart(2, "0")),
47201
+ label: label12(h, m)
47202
+ });
47203
+ }
47204
+ }
47205
+ return opts;
47206
+ }();
47207
+ var DEFAULT_SCHEDULE = {
47208
+ frequency: "off",
47209
+ time: "09:00",
47210
+ dayOfWeek: "1",
47211
+ dayOfMonth: "1"
47212
+ };
47213
+ function parseHM(time) {
47214
+ var _String$split$map = String(time || "09:00").split(":").map(function (n) {
47215
+ return parseInt(n, 10);
47216
+ }),
47217
+ _String$split$map2 = _slicedToArray(_String$split$map, 2),
47218
+ h = _String$split$map2[0],
47219
+ m = _String$split$map2[1];
47220
+ return [Number.isFinite(h) ? h : 9, Number.isFinite(m) ? m : 0];
47221
+ }
47222
+
47223
+ /**
47224
+ * @param {{frequency:string, time?:string, dayOfWeek?:string, dayOfMonth?:string}} s
47225
+ * @returns {string} cron expression, or "" for "off"
47226
+ */
47227
+ function buildCron() {
47228
+ var s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47229
+ var frequency = s.frequency,
47230
+ _s$time = s.time,
47231
+ time = _s$time === void 0 ? "09:00" : _s$time,
47232
+ _s$dayOfWeek = s.dayOfWeek,
47233
+ dayOfWeek = _s$dayOfWeek === void 0 ? "1" : _s$dayOfWeek,
47234
+ _s$dayOfMonth = s.dayOfMonth,
47235
+ dayOfMonth = _s$dayOfMonth === void 0 ? "1" : _s$dayOfMonth;
47236
+ var _parseHM = parseHM(time),
47237
+ _parseHM2 = _slicedToArray(_parseHM, 2),
47238
+ h = _parseHM2[0],
47239
+ m = _parseHM2[1];
47240
+ switch (frequency) {
47241
+ case "hourly":
47242
+ return "0 * * * *";
47243
+ case "daily":
47244
+ return "".concat(m, " ").concat(h, " * * *");
47245
+ case "weekday":
47246
+ return "".concat(m, " ").concat(h, " * * 1-5");
47247
+ case "weekly":
47248
+ return "".concat(m, " ").concat(h, " * * ").concat(dayOfWeek);
47249
+ case "monthly":
47250
+ return "".concat(m, " ").concat(h, " ").concat(dayOfMonth, " * *");
47251
+ case "off":
47252
+ default:
47253
+ return "";
47254
+ }
47255
+ }
47256
+
47257
+ /**
47258
+ * Best-effort inverse of buildCron for edit mode.
47259
+ * @param {string} cron
47260
+ * @returns {{frequency:string, time?:string, dayOfWeek?:string, dayOfMonth?:string}}
47261
+ */
47262
+ function parseCron(cron) {
47263
+ if (!cron || !String(cron).trim()) return {
47264
+ frequency: "off"
47265
+ };
47266
+ var parts = String(cron).trim().split(/\s+/);
47267
+ if (parts.length !== 5) return {
47268
+ frequency: "custom"
47269
+ };
47270
+ var _parts = _slicedToArray(parts, 5),
47271
+ min = _parts[0],
47272
+ hour = _parts[1],
47273
+ dom = _parts[2],
47274
+ month = _parts[3],
47275
+ dow = _parts[4];
47276
+ if (hour === "*" && min === "0" && dom === "*" && month === "*" && dow === "*") return {
47277
+ frequency: "hourly"
47278
+ };
47279
+ var m = parseInt(min, 10);
47280
+ var h = parseInt(hour, 10);
47281
+ if (!Number.isFinite(m) || !Number.isFinite(h) || month !== "*") return {
47282
+ frequency: "custom"
47283
+ };
47284
+ var time = "".concat(String(h).padStart(2, "0"), ":").concat(String(m).padStart(2, "0"));
47285
+ if (dom === "*" && dow === "*") return {
47286
+ frequency: "daily",
47287
+ time: time
47288
+ };
47289
+ if (dom === "*" && dow === "1-5") return {
47290
+ frequency: "weekday",
47291
+ time: time
47292
+ };
47293
+ if (dom === "*" && /^[0-6]$/.test(dow)) return {
47294
+ frequency: "weekly",
47295
+ time: time,
47296
+ dayOfWeek: dow
47297
+ };
47298
+ if (/^([1-9]|1[0-9]|2[0-8])$/.test(dom) && dow === "*") return {
47299
+ frequency: "monthly",
47300
+ time: time,
47301
+ dayOfMonth: dom
47302
+ };
47303
+ return {
47304
+ frequency: "custom"
47305
+ };
47306
+ }
47307
+
47110
47308
  function ownKeys$t(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; }
47111
47309
  function _objectSpread$t(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$t(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$t(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
47112
- var AI_PROVIDER_TYPES = ["anthropic", "openai", "xai"];
47310
+ var PROVIDER_LABELS = {
47311
+ anthropic: "Anthropic",
47312
+ openai: "OpenAI",
47313
+ xai: "xAI"
47314
+ };
47315
+ var AI_PROVIDER_TYPES = Object.keys(PROVIDER_LABELS);
47113
47316
  function providerOptionsFrom(providers) {
47114
47317
  var present = new Set();
47115
47318
  for (var _i = 0, _Object$values = Object.values(providers || {}); _i < _Object$values.length; _i++) {
@@ -47122,7 +47325,7 @@ function providerOptionsFrom(providers) {
47122
47325
  }].concat(_toConsumableArray(_toConsumableArray(present).map(function (t) {
47123
47326
  return {
47124
47327
  value: t,
47125
- label: t
47328
+ label: PROVIDER_LABELS[t] || t
47126
47329
  };
47127
47330
  })));
47128
47331
  }
@@ -47133,6 +47336,27 @@ var APPROVAL_OPTIONS = [{
47133
47336
  value: "allow",
47134
47337
  label: "Allow without prompting"
47135
47338
  }];
47339
+
47340
+ // Server ids are lower-case; show a friendlier label without changing the value
47341
+ // the runner resolves against.
47342
+ var SERVER_LABELS = {
47343
+ github: "GitHub",
47344
+ gitlab: "GitLab",
47345
+ openai: "OpenAI",
47346
+ gmail: "Gmail",
47347
+ slack: "Slack",
47348
+ notion: "Notion",
47349
+ linear: "Linear"
47350
+ };
47351
+ function prettyServer(name) {
47352
+ if (SERVER_LABELS[name]) return SERVER_LABELS[name];
47353
+ return String(name || "").split(/[-_\s]+/).filter(Boolean).map(function (w) {
47354
+ return w.charAt(0).toUpperCase() + w.slice(1);
47355
+ }).join(" ");
47356
+ }
47357
+ function getMainApi() {
47358
+ return typeof window !== "undefined" ? window.mainApi : null;
47359
+ }
47136
47360
  var BotDetail = function BotDetail(_ref) {
47137
47361
  var _bot$schedules, _bot$schedules2;
47138
47362
  var _ref$bot = _ref.bot,
@@ -47164,39 +47388,139 @@ var BotDetail = function BotDetail(_ref) {
47164
47388
  _useState0 = _slicedToArray(_useState9, 2),
47165
47389
  approvalPolicy = _useState0[0],
47166
47390
  setApprovalPolicy = _useState0[1];
47167
- var _useState1 = React.useState(((bot === null || bot === void 0 ? void 0 : bot.mcpServers) || []).join(", ")),
47391
+
47392
+ // --- Tools & integrations (MCP servers) ---
47393
+ var _useState1 = React.useState((bot === null || bot === void 0 ? void 0 : bot.mcpServers) || []),
47168
47394
  _useState10 = _slicedToArray(_useState1, 2),
47169
- mcpServers = _useState10[0],
47170
- setMcpServers = _useState10[1];
47171
- var _useState11 = React.useState((bot === null || bot === void 0 || (_bot$schedules = bot.schedules) === null || _bot$schedules === void 0 || (_bot$schedules = _bot$schedules[0]) === null || _bot$schedules === void 0 ? void 0 : _bot$schedules.cron) || ""),
47395
+ selectedServers = _useState10[0],
47396
+ setSelectedServers = _useState10[1];
47397
+ var _useState11 = React.useState([]),
47172
47398
  _useState12 = _slicedToArray(_useState11, 2),
47173
- cron = _useState12[0],
47174
- setCron = _useState12[1];
47175
- var _useState13 = React.useState((bot === null || bot === void 0 || (_bot$schedules2 = bot.schedules) === null || _bot$schedules2 === void 0 || (_bot$schedules2 = _bot$schedules2[0]) === null || _bot$schedules2 === void 0 ? void 0 : _bot$schedules2.prompt) || ""),
47399
+ connectedServers = _useState12[0],
47400
+ setConnectedServers = _useState12[1];
47401
+
47402
+ // --- Model options (fetched per provider) ---
47403
+ var _useState13 = React.useState([]),
47176
47404
  _useState14 = _slicedToArray(_useState13, 2),
47177
- schedulePrompt = _useState14[0],
47178
- setSchedulePrompt = _useState14[1];
47179
- var _useState15 = React.useState(false),
47405
+ modelOptions = _useState14[0],
47406
+ setModelOptions = _useState14[1];
47407
+
47408
+ // --- Schedule (friendly dropdowns; raw cron behind Advanced) ---
47409
+ var initialCron = (bot === null || bot === void 0 || (_bot$schedules = bot.schedules) === null || _bot$schedules === void 0 || (_bot$schedules = _bot$schedules[0]) === null || _bot$schedules === void 0 ? void 0 : _bot$schedules.cron) || "";
47410
+ var parsed = parseCron(initialCron);
47411
+ var _useState15 = React.useState(parsed.frequency === "custom" ? "off" : parsed.frequency),
47180
47412
  _useState16 = _slicedToArray(_useState15, 2),
47181
- saving = _useState16[0],
47182
- setSaving = _useState16[1];
47183
- var _useState17 = React.useState(null),
47413
+ frequency = _useState16[0],
47414
+ setFrequency = _useState16[1];
47415
+ var _useState17 = React.useState(parsed.time || DEFAULT_SCHEDULE.time),
47184
47416
  _useState18 = _slicedToArray(_useState17, 2),
47185
- error = _useState18[0],
47186
- setError = _useState18[1];
47417
+ time = _useState18[0],
47418
+ setTime = _useState18[1];
47419
+ var _useState19 = React.useState(parsed.dayOfWeek || DEFAULT_SCHEDULE.dayOfWeek),
47420
+ _useState20 = _slicedToArray(_useState19, 2),
47421
+ dayOfWeek = _useState20[0],
47422
+ setDayOfWeek = _useState20[1];
47423
+ var _useState21 = React.useState(parsed.dayOfMonth || DEFAULT_SCHEDULE.dayOfMonth),
47424
+ _useState22 = _slicedToArray(_useState21, 2),
47425
+ dayOfMonth = _useState22[0],
47426
+ setDayOfMonth = _useState22[1];
47427
+ var _useState23 = React.useState(parsed.frequency === "custom"),
47428
+ _useState24 = _slicedToArray(_useState23, 2),
47429
+ advanced = _useState24[0],
47430
+ setAdvanced = _useState24[1];
47431
+ var _useState25 = React.useState(initialCron),
47432
+ _useState26 = _slicedToArray(_useState25, 2),
47433
+ advancedCron = _useState26[0],
47434
+ setAdvancedCron = _useState26[1];
47435
+ var _useState27 = React.useState((bot === null || bot === void 0 || (_bot$schedules2 = bot.schedules) === null || _bot$schedules2 === void 0 || (_bot$schedules2 = _bot$schedules2[0]) === null || _bot$schedules2 === void 0 ? void 0 : _bot$schedules2.prompt) || ""),
47436
+ _useState28 = _slicedToArray(_useState27, 2),
47437
+ schedulePrompt = _useState28[0],
47438
+ setSchedulePrompt = _useState28[1];
47439
+ var _useState29 = React.useState(false),
47440
+ _useState30 = _slicedToArray(_useState29, 2),
47441
+ saving = _useState30[0],
47442
+ setSaving = _useState30[1];
47443
+ var _useState31 = React.useState(null),
47444
+ _useState32 = _slicedToArray(_useState31, 2),
47445
+ error = _useState32[0],
47446
+ setError = _useState32[1];
47447
+
47448
+ // Discover the user's connected integrations for the picker.
47449
+ React.useEffect(function () {
47450
+ var _api$llm;
47451
+ var alive = true;
47452
+ var api = getMainApi();
47453
+ if (!(api !== null && api !== void 0 && (_api$llm = api.llm) !== null && _api$llm !== void 0 && _api$llm.listConnectedTools)) return undefined;
47454
+ api.llm.listConnectedTools().then(function (servers) {
47455
+ if (!alive || !Array.isArray(servers)) return;
47456
+ setConnectedServers(servers.map(function (s) {
47457
+ return s.serverName;
47458
+ }).filter(Boolean));
47459
+ })["catch"](function () {});
47460
+ return function () {
47461
+ alive = false;
47462
+ };
47463
+ }, []);
47464
+
47465
+ // Fetch the model list for the chosen provider.
47466
+ React.useEffect(function () {
47467
+ var _api$llm2;
47468
+ var alive = true;
47469
+ var api = getMainApi();
47470
+ if (!(api !== null && api !== void 0 && (_api$llm2 = api.llm) !== null && _api$llm2 !== void 0 && _api$llm2.listModels)) {
47471
+ setModelOptions([]);
47472
+ return undefined;
47473
+ }
47474
+ api.llm.listModels(provider || "anthropic").then(function (res) {
47475
+ if (alive) setModelOptions(res && res.models || []);
47476
+ })["catch"](function () {
47477
+ if (alive) setModelOptions([]);
47478
+ });
47479
+ return function () {
47480
+ alive = false;
47481
+ };
47482
+ }, [provider]);
47483
+
47484
+ // Union of connected servers + any the bot already has (so an attached server
47485
+ // that isn't currently connected still shows, checked, and isn't dropped).
47486
+ var availableServers = _toConsumableArray(new Set([].concat(_toConsumableArray(selectedServers || []), _toConsumableArray(connectedServers)))).map(function (serverName) {
47487
+ return {
47488
+ serverName: serverName,
47489
+ label: prettyServer(serverName)
47490
+ };
47491
+ });
47492
+ var modelSelectOptions = [{
47493
+ value: "",
47494
+ label: "Recommended (default)"
47495
+ }].concat(_toConsumableArray(model && !modelOptions.some(function (m) {
47496
+ return m.value === model;
47497
+ }) ? [{
47498
+ value: model,
47499
+ label: model
47500
+ }] : []), _toConsumableArray(modelOptions));
47501
+ var toggleServer = function toggleServer(serverName) {
47502
+ setSelectedServers(function (prev) {
47503
+ return prev.includes(serverName) ? prev.filter(function (s) {
47504
+ return s !== serverName;
47505
+ }) : [].concat(_toConsumableArray(prev), [serverName]);
47506
+ });
47507
+ };
47187
47508
  var canSave = name.trim() && instructions.trim() && !saving;
47188
47509
  var handleSave = /*#__PURE__*/function () {
47189
47510
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
47190
- var servers, schedules, definition, _t;
47511
+ var cron, schedules, definition, _t;
47191
47512
  return _regeneratorRuntime.wrap(function (_context) {
47192
47513
  while (1) switch (_context.prev = _context.next) {
47193
47514
  case 0:
47194
47515
  setError(null);
47195
- servers = mcpServers.split(",").map(function (s) {
47196
- return s.trim();
47197
- }).filter(Boolean);
47198
- schedules = cron.trim() ? [{
47199
- cron: cron.trim(),
47516
+ cron = advanced ? advancedCron.trim() : buildCron({
47517
+ frequency: frequency,
47518
+ time: time,
47519
+ dayOfWeek: dayOfWeek,
47520
+ dayOfMonth: dayOfMonth
47521
+ });
47522
+ schedules = cron ? [{
47523
+ cron: cron,
47200
47524
  prompt: schedulePrompt.trim()
47201
47525
  }] : [];
47202
47526
  definition = _objectSpread$t(_objectSpread$t({}, bot !== null && bot !== void 0 && bot.id ? {
@@ -47207,7 +47531,7 @@ var BotDetail = function BotDetail(_ref) {
47207
47531
  provider: provider || null,
47208
47532
  model: model.trim() || null,
47209
47533
  approvalPolicy: approvalPolicy,
47210
- mcpServers: servers,
47534
+ mcpServers: selectedServers,
47211
47535
  schedules: schedules
47212
47536
  });
47213
47537
  setSaving(true);
@@ -47235,6 +47559,7 @@ var BotDetail = function BotDetail(_ref) {
47235
47559
  return _ref2.apply(this, arguments);
47236
47560
  };
47237
47561
  }();
47562
+ var scheduleOn = advanced || frequency !== "off";
47238
47563
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
47239
47564
  className: "flex flex-col flex-1 min-h-0",
47240
47565
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -47266,16 +47591,12 @@ var BotDetail = function BotDetail(_ref) {
47266
47591
  onChange: setProvider,
47267
47592
  options: providerOptionsFrom(providers),
47268
47593
  placeholder: "Default provider"
47269
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
47270
- className: "flex flex-col gap-2",
47271
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
47272
- className: "text-sm font-medium",
47273
- children: "Model"
47274
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
47275
- value: model,
47276
- onChange: setModel,
47277
- placeholder: "Leave blank for the recommended model"
47278
- })]
47594
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47595
+ label: "Model",
47596
+ value: model,
47597
+ onChange: setModel,
47598
+ options: modelSelectOptions,
47599
+ placeholder: "Recommended (default)"
47279
47600
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47280
47601
  label: "Approval policy",
47281
47602
  value: approvalPolicy,
@@ -47285,29 +47606,71 @@ var BotDetail = function BotDetail(_ref) {
47285
47606
  className: "flex flex-col gap-2",
47286
47607
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
47287
47608
  className: "text-sm font-medium",
47288
- children: "MCP servers"
47289
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
47290
- value: mcpServers,
47291
- onChange: setMcpServers,
47292
- placeholder: "Comma-separated server names, e.g. github, slack"
47609
+ children: "Tools & integrations"
47610
+ }), availableServers.length ? /*#__PURE__*/jsxRuntime.jsx("div", {
47611
+ className: "flex flex-col gap-1",
47612
+ children: availableServers.map(function (s) {
47613
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.Checkbox, {
47614
+ label: s.label,
47615
+ checked: selectedServers.includes(s.serverName),
47616
+ onChange: function onChange() {
47617
+ return toggleServer(s.serverName);
47618
+ }
47619
+ }, s.serverName);
47620
+ })
47621
+ }) : /*#__PURE__*/jsxRuntime.jsx("span", {
47622
+ className: "text-xs opacity-50",
47623
+ children: "No connected integrations yet. Add one under Settings \u2192 MCP Server, then it will appear here."
47293
47624
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
47294
47625
  className: "text-xs opacity-50",
47295
- children: "Tools on these servers route through the approval policy above."
47626
+ children: "Tools on these integrations route through the approval policy above."
47296
47627
  })]
47297
47628
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
47298
47629
  className: "flex flex-col gap-2",
47299
47630
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
47300
47631
  className: "text-sm font-medium",
47301
- children: "Schedule (optional)"
47302
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
47303
- value: cron,
47304
- onChange: setCron,
47632
+ children: "Schedule"
47633
+ }), !advanced ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
47634
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47635
+ label: "Runs",
47636
+ value: frequency,
47637
+ onChange: setFrequency,
47638
+ options: FREQUENCIES
47639
+ }), frequency !== "off" && frequency !== "hourly" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47640
+ label: "Time",
47641
+ value: time,
47642
+ onChange: setTime,
47643
+ options: TIME_OPTIONS
47644
+ }) : null, frequency === "weekly" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47645
+ label: "Day of week",
47646
+ value: dayOfWeek,
47647
+ onChange: setDayOfWeek,
47648
+ options: DAYS_OF_WEEK
47649
+ }) : null, frequency === "monthly" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47650
+ label: "Day of month",
47651
+ value: dayOfMonth,
47652
+ onChange: setDayOfMonth,
47653
+ options: DAYS_OF_MONTH
47654
+ }) : null]
47655
+ }) : /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
47656
+ label: "Cron expression",
47657
+ value: advancedCron,
47658
+ onChange: setAdvancedCron,
47305
47659
  placeholder: "Cron, e.g. 0 7 * * 1-5"
47306
- }), cron.trim() ? /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
47660
+ }), scheduleOn ? /*#__PURE__*/jsxRuntime.jsx(DashReact.InputText, {
47307
47661
  value: schedulePrompt,
47308
47662
  onChange: setSchedulePrompt,
47309
47663
  placeholder: "Task prompt for the scheduled run"
47310
- }) : null]
47664
+ }) : null, /*#__PURE__*/jsxRuntime.jsx("button", {
47665
+ type: "button",
47666
+ onClick: function onClick() {
47667
+ return setAdvanced(function (v) {
47668
+ return !v;
47669
+ });
47670
+ },
47671
+ className: "text-xs opacity-60 hover:opacity-100 self-start",
47672
+ children: advanced ? "Use simple schedule" : "Advanced (cron)"
47673
+ })]
47311
47674
  }), error ? /*#__PURE__*/jsxRuntime.jsx("span", {
47312
47675
  className: "text-sm text-red-400",
47313
47676
  children: error