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