@hyperwindmill/caretaker-cli 0.20.0 → 0.21.0

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.
Files changed (42) hide show
  1. package/dist/cli/mcp.js +5 -5
  2. package/dist/cli/web/mcp_bridge.d.ts +1 -1
  3. package/dist/cli/web/mcp_bridge.d.ts.map +1 -1
  4. package/dist/cli/web/mcp_bridge.js +23 -7
  5. package/dist/cli/web/scheduler/heartbeat.d.ts +2 -2
  6. package/dist/cli/web/scheduler/heartbeat.d.ts.map +1 -1
  7. package/dist/cli/web/scheduler/strategy.d.ts +3 -3
  8. package/dist/cli/web/scheduler/strategy.d.ts.map +1 -1
  9. package/dist/cli/web/scheduler/task_roles.d.ts +0 -4
  10. package/dist/cli/web/scheduler/task_roles.d.ts.map +1 -1
  11. package/dist/cli/web/scheduler/task_roles.js +12 -2
  12. package/dist/cli/web/scheduler/task_strategy.d.ts.map +1 -1
  13. package/dist/cli/web/scheduler/task_strategy.js +4 -1
  14. package/dist/cli/web/scheduler/telegram.d.ts.map +1 -1
  15. package/dist/cli/web/scheduler/telegram.js +4 -1
  16. package/dist/cli/web/server.d.ts.map +1 -1
  17. package/dist/cli/web/server.js +10 -4
  18. package/dist/harness/claude_code_runner.d.ts.map +1 -1
  19. package/dist/harness/claude_code_runner.js +5 -1
  20. package/dist/harness/tools/builtin/email_tools.d.ts +5 -0
  21. package/dist/harness/tools/builtin/email_tools.d.ts.map +1 -0
  22. package/dist/harness/tools/builtin/email_tools.js +182 -0
  23. package/dist/harness/tools/builtin/index.d.ts +2 -1
  24. package/dist/harness/tools/builtin/index.d.ts.map +1 -1
  25. package/dist/harness/tools/builtin/index.js +7 -1
  26. package/dist/harness/tools/resolve.d.ts.map +1 -1
  27. package/dist/harness/tools/resolve.js +9 -4
  28. package/dist/lib/email.d.ts +132 -0
  29. package/dist/lib/email.d.ts.map +1 -0
  30. package/dist/lib/email.js +306 -0
  31. package/dist/mcp/builtin_server.d.ts +13 -0
  32. package/dist/mcp/builtin_server.d.ts.map +1 -0
  33. package/dist/mcp/builtin_server.js +65 -0
  34. package/dist/store/json.d.ts.map +1 -1
  35. package/dist/store/json.js +6 -0
  36. package/dist/tui/agents.js +36 -14
  37. package/dist/webview/standalone.js +340 -35
  38. package/dist/webview/standalone.js.map +3 -3
  39. package/package.json +8 -3
  40. package/dist/mcp/task_server.d.ts +0 -9
  41. package/dist/mcp/task_server.d.ts.map +0 -1
  42. package/dist/mcp/task_server.js +0 -48
@@ -17023,9 +17023,10 @@ ${text}</tr>
17023
17023
  const initialTools = {};
17024
17024
  const initialConfirm = {};
17025
17025
  availableTools.forEach((t) => {
17026
- if (t === "mcp__task__*") {
17027
- initialTools[t] = agent.allowedTools.includes(t) || agent.allowedTools.some((x) => x.startsWith("mcp__task__"));
17028
- initialConfirm[t] = agent.confirmTools?.includes(t) || agent.confirmTools?.some((x) => x.startsWith("mcp__task__")) || false;
17026
+ const ns = /^(mcp__[a-z]+__)\*$/.exec(t);
17027
+ if (ns) {
17028
+ initialTools[t] = agent.allowedTools.includes(t) || agent.allowedTools.some((x) => x.startsWith(ns[1]));
17029
+ initialConfirm[t] = agent.confirmTools?.includes(t) || agent.confirmTools?.some((x) => x.startsWith(ns[1])) || false;
17029
17030
  } else {
17030
17031
  initialTools[t] = agent.allowedTools.includes(t);
17031
17032
  initialConfirm[t] = agent.confirmTools?.includes(t) || false;
@@ -18158,7 +18159,7 @@ ${text}</tr>
18158
18159
  ] });
18159
18160
  }
18160
18161
 
18161
- // src/SchedulerTab.tsx
18162
+ // src/ServicesTab.tsx
18162
18163
  var import_react13 = __toESM(require_react(), 1);
18163
18164
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
18164
18165
  function closeStreamingAssistant(items) {
@@ -18216,7 +18217,7 @@ ${text}</tr>
18216
18217
  }
18217
18218
  return closeStreamingAssistant(items);
18218
18219
  }
18219
- function SchedulerTab({ config, agents, postMessage, taskRuns = {} }) {
18220
+ function ServicesTab({ config, agents, postMessage, taskRuns = {} }) {
18220
18221
  const tasks = config.scheduler?.tasks || [];
18221
18222
  const [editingTask, setEditingTask] = (0, import_react13.useState)(null);
18222
18223
  const [isCreating, setIsCreating] = (0, import_react13.useState)(false);
@@ -18231,6 +18232,20 @@ ${text}</tr>
18231
18232
  const [cron, setCron] = (0, import_react13.useState)("*/15 * * * *");
18232
18233
  const [telegramBotToken, setTelegramBotToken] = (0, import_react13.useState)("");
18233
18234
  const [telegramAllowedChats, setTelegramAllowedChats] = (0, import_react13.useState)("");
18235
+ const [imapHost, setImapHost] = (0, import_react13.useState)("");
18236
+ const [imapPort, setImapPort] = (0, import_react13.useState)("993");
18237
+ const [imapUser, setImapUser] = (0, import_react13.useState)("");
18238
+ const [imapPassword, setImapPassword] = (0, import_react13.useState)("");
18239
+ const [imapSecure, setImapSecure] = (0, import_react13.useState)(true);
18240
+ const [smtpHost, setSmtpHost] = (0, import_react13.useState)("");
18241
+ const [smtpPort, setSmtpPort] = (0, import_react13.useState)("587");
18242
+ const [smtpSecure, setSmtpSecure] = (0, import_react13.useState)(false);
18243
+ const [smtpFrom, setSmtpFrom] = (0, import_react13.useState)("");
18244
+ const [smtpUser, setSmtpUser] = (0, import_react13.useState)("");
18245
+ const [smtpPassword, setSmtpPassword] = (0, import_react13.useState)("");
18246
+ const [allowedSenders, setAllowedSenders] = (0, import_react13.useState)("");
18247
+ const [allowedRecipients, setAllowedRecipients] = (0, import_react13.useState)("");
18248
+ const [allowedAgents, setAllowedAgents] = (0, import_react13.useState)([]);
18234
18249
  const [errorMsg, setErrorMsg] = (0, import_react13.useState)(null);
18235
18250
  const startEdit = (task) => {
18236
18251
  setEditingTask(task);
@@ -18244,6 +18259,20 @@ ${text}</tr>
18244
18259
  setCron(task.cron);
18245
18260
  setTelegramBotToken(task.telegramBotToken || "");
18246
18261
  setTelegramAllowedChats(task.telegramAllowedChats || "");
18262
+ setImapHost(task.imapHost || "");
18263
+ setImapPort(task.imapPort ? String(task.imapPort) : "993");
18264
+ setImapUser(task.imapUser || "");
18265
+ setImapPassword(task.imapPassword || "");
18266
+ setImapSecure(task.imapSecure !== false);
18267
+ setSmtpHost(task.smtpHost || "");
18268
+ setSmtpPort(task.smtpPort ? String(task.smtpPort) : "587");
18269
+ setSmtpSecure(task.smtpSecure === true);
18270
+ setSmtpFrom(task.smtpFrom || "");
18271
+ setSmtpUser(task.smtpUser || "");
18272
+ setSmtpPassword(task.smtpPassword || "");
18273
+ setAllowedSenders(task.allowedSenders || "");
18274
+ setAllowedRecipients(task.allowedRecipients || "");
18275
+ setAllowedAgents(task.allowedAgents || []);
18247
18276
  setErrorMsg(null);
18248
18277
  };
18249
18278
  const startCreate = () => {
@@ -18258,6 +18287,20 @@ ${text}</tr>
18258
18287
  setCron("*/15 * * * *");
18259
18288
  setTelegramBotToken("");
18260
18289
  setTelegramAllowedChats("");
18290
+ setImapHost("");
18291
+ setImapPort("993");
18292
+ setImapUser("");
18293
+ setImapPassword("");
18294
+ setImapSecure(true);
18295
+ setSmtpHost("");
18296
+ setSmtpPort("587");
18297
+ setSmtpSecure(false);
18298
+ setSmtpFrom("");
18299
+ setSmtpUser("");
18300
+ setSmtpPassword("");
18301
+ setAllowedSenders("");
18302
+ setAllowedRecipients("");
18303
+ setAllowedAgents([]);
18261
18304
  setErrorMsg(null);
18262
18305
  };
18263
18306
  const cancelForm = () => {
@@ -18272,11 +18315,11 @@ ${text}</tr>
18272
18315
  const trimmedPrompt = prompt.trim();
18273
18316
  const trimmedCron = cron.trim();
18274
18317
  if (!trimmedName) {
18275
- setErrorMsg("Task Name is required.");
18318
+ setErrorMsg("Service Name is required.");
18276
18319
  return;
18277
18320
  }
18278
- if (!agentId) {
18279
- setErrorMsg("Please select an agent for this task.");
18321
+ if (!agentId && type !== "email") {
18322
+ setErrorMsg("Please select an agent for this service.");
18280
18323
  return;
18281
18324
  }
18282
18325
  let finalPrompt = trimmedPrompt;
@@ -18302,14 +18345,33 @@ ${text}</tr>
18302
18345
  }
18303
18346
  finalPrompt = "Telegram Poller";
18304
18347
  finalCron = "* * * * *";
18348
+ } else if (type === "email") {
18349
+ if (!imapHost.trim() || !imapUser.trim() || !imapPassword.trim()) {
18350
+ setErrorMsg("IMAP host, user and password are required.");
18351
+ return;
18352
+ }
18353
+ const port = Number(imapPort);
18354
+ if (!Number.isInteger(port) || port < 1 || port > 65535) {
18355
+ setErrorMsg("IMAP port must be a whole number between 1 and 65535.");
18356
+ return;
18357
+ }
18358
+ if (smtpHost.trim()) {
18359
+ const outPort = Number(smtpPort);
18360
+ if (!Number.isInteger(outPort) || outPort < 1 || outPort > 65535) {
18361
+ setErrorMsg("SMTP port must be a whole number between 1 and 65535.");
18362
+ return;
18363
+ }
18364
+ }
18365
+ finalPrompt = "Email (IMAP) credentials";
18366
+ finalCron = "";
18305
18367
  }
18306
18368
  const existing = tasks.find((t) => t.name.toLowerCase() === trimmedName.toLowerCase());
18307
18369
  if (isCreating && existing) {
18308
- setErrorMsg(`A task named "${trimmedName}" already exists.`);
18370
+ setErrorMsg(`A service named "${trimmedName}" already exists.`);
18309
18371
  return;
18310
18372
  }
18311
18373
  if (editingTask && editingTask.name.toLowerCase() !== trimmedName.toLowerCase() && existing) {
18312
- setErrorMsg(`A task named "${trimmedName}" already exists.`);
18374
+ setErrorMsg(`A service named "${trimmedName}" already exists.`);
18313
18375
  return;
18314
18376
  }
18315
18377
  const taskData = {
@@ -18317,13 +18379,29 @@ ${text}</tr>
18317
18379
  name: trimmedName,
18318
18380
  type,
18319
18381
  enabled,
18320
- agentId,
18382
+ agentId: type === "email" ? "" : agentId,
18321
18383
  cron: finalCron,
18322
18384
  prompt: finalPrompt,
18323
18385
  ...trimmedWorkingDir ? { workingDir: trimmedWorkingDir } : {},
18324
18386
  ...type === "telegram" ? {
18325
18387
  telegramBotToken: telegramBotToken.trim(),
18326
18388
  telegramAllowedChats: telegramAllowedChats.trim()
18389
+ } : {},
18390
+ ...type === "email" ? {
18391
+ imapHost: imapHost.trim(),
18392
+ imapPort: Number(imapPort),
18393
+ imapUser: imapUser.trim(),
18394
+ imapPassword: imapPassword.trim(),
18395
+ imapSecure,
18396
+ smtpHost: smtpHost.trim(),
18397
+ smtpPort: Number(smtpPort),
18398
+ smtpSecure,
18399
+ smtpFrom: smtpFrom.trim(),
18400
+ smtpUser: smtpUser.trim(),
18401
+ smtpPassword: smtpPassword.trim(),
18402
+ allowedSenders: allowedSenders.trim(),
18403
+ allowedRecipients: allowedRecipients.trim(),
18404
+ allowedAgents
18327
18405
  } : {}
18328
18406
  };
18329
18407
  let updatedTasks = [...tasks];
@@ -18387,10 +18465,10 @@ ${text}</tr>
18387
18465
  const activeRun = runs.find((r) => r.runId === activeRunId);
18388
18466
  const activeRunChatItems = (0, import_react13.useMemo)(() => activeRun ? reconstructChatItems(activeRun.messages || []) : [], [activeRun]);
18389
18467
  const selectedAgentName = viewingTaskLogs ? agents.find((a) => a.id === viewingTaskLogs.agentId)?.name : "";
18390
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tab-pane scheduler-tab", children: [
18468
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tab-pane services-tab", children: [
18391
18469
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tab-pane__header", children: [
18392
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { children: "Scheduled Tasks" }),
18393
- !showForm && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { className: "btn btn--primary btn--xs", onClick: startCreate, children: "+ Add Task" })
18470
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { children: "Services" }),
18471
+ !showForm && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { className: "btn btn--primary btn--xs", onClick: startCreate, children: "+ Add Service" })
18394
18472
  ] }),
18395
18473
  errorMsg && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "validation-error", children: [
18396
18474
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TriangleAlert, { size: 14 }),
@@ -18398,10 +18476,10 @@ ${text}</tr>
18398
18476
  errorMsg
18399
18477
  ] }),
18400
18478
  showForm ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "glass-form", children: [
18401
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h4", { children: isCreating ? "Add Scheduled Task" : `Edit Task: ${editingTask?.name}` }),
18479
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h4", { children: isCreating ? "Add Service" : `Edit Service: ${editingTask?.name}` }),
18402
18480
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "glass-form__body", children: [
18403
18481
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18404
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "task-name", children: "Task Name" }),
18482
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "task-name", children: "Service Name" }),
18405
18483
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18406
18484
  "input",
18407
18485
  {
@@ -18414,7 +18492,7 @@ ${text}</tr>
18414
18492
  )
18415
18493
  ] }),
18416
18494
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18417
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "task-type", children: "Task Type" }),
18495
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "task-type", children: "Service Type" }),
18418
18496
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
18419
18497
  "select",
18420
18498
  {
@@ -18432,8 +18510,9 @@ ${text}</tr>
18432
18510
  cursor: "pointer"
18433
18511
  },
18434
18512
  children: [
18435
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "heartbeat", children: "Heartbeat (Recurring Agent Execution)" }),
18436
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "telegram", children: "Telegram Poller (Autonomous Telegram Agent)" })
18513
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "heartbeat", children: "Heartbeat (Scheduled Agent Run)" }),
18514
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "telegram", children: "Telegram Bot (Poller)" }),
18515
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "email", children: "Email (IMAP credentials)" })
18437
18516
  ]
18438
18517
  }
18439
18518
  )
@@ -18449,9 +18528,9 @@ ${text}</tr>
18449
18528
  style: { width: "auto", cursor: "pointer" }
18450
18529
  }
18451
18530
  ),
18452
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "task-enabled", style: { cursor: "pointer", fontWeight: 600, fontSize: "12px" }, children: "Active (Run scheduler for this task)" })
18531
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "task-enabled", style: { cursor: "pointer", fontWeight: 600, fontSize: "12px" }, children: "Active" })
18453
18532
  ] }),
18454
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18533
+ type !== "email" && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18455
18534
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "task-agent", children: "Agent to Execute" }),
18456
18535
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
18457
18536
  "select",
@@ -18527,7 +18606,7 @@ ${text}</tr>
18527
18606
  }
18528
18607
  )
18529
18608
  ] })
18530
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
18609
+ ] }) : type === "telegram" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
18531
18610
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18532
18611
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "tg-token", children: "Telegram Bot Token" }),
18533
18612
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -18597,13 +18676,227 @@ ${text}</tr>
18597
18676
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("li", { children: "Whitelist your chat ID above to prevent unauthorized users from using your local shell/tools!" })
18598
18677
  ] })
18599
18678
  ] })
18679
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
18680
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18681
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "imap-host", children: "IMAP Host" }),
18682
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18683
+ "input",
18684
+ {
18685
+ id: "imap-host",
18686
+ type: "text",
18687
+ placeholder: "e.g. imap.gmail.com",
18688
+ value: imapHost,
18689
+ onChange: (e) => setImapHost(e.target.value)
18690
+ }
18691
+ )
18692
+ ] }),
18693
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18694
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "imap-port", children: "Port" }),
18695
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18696
+ "input",
18697
+ {
18698
+ id: "imap-port",
18699
+ type: "number",
18700
+ value: imapPort,
18701
+ onChange: (e) => setImapPort(e.target.value)
18702
+ }
18703
+ )
18704
+ ] }),
18705
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", style: { display: "flex", alignItems: "center", gap: "8px", margin: "14px 0" }, children: [
18706
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18707
+ "input",
18708
+ {
18709
+ id: "imap-secure",
18710
+ type: "checkbox",
18711
+ checked: imapSecure,
18712
+ onChange: (e) => setImapSecure(e.target.checked),
18713
+ style: { width: "auto", cursor: "pointer" }
18714
+ }
18715
+ ),
18716
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "imap-secure", style: { cursor: "pointer", fontWeight: 600, fontSize: "12px" }, children: "Use TLS (implicit, port 993)" })
18717
+ ] }),
18718
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18719
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "imap-user", children: "Username" }),
18720
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18721
+ "input",
18722
+ {
18723
+ id: "imap-user",
18724
+ type: "text",
18725
+ placeholder: "e.g. you@example.com",
18726
+ value: imapUser,
18727
+ onChange: (e) => setImapUser(e.target.value)
18728
+ }
18729
+ )
18730
+ ] }),
18731
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18732
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "imap-password", children: "Password / App Password" }),
18733
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18734
+ "input",
18735
+ {
18736
+ id: "imap-password",
18737
+ type: "password",
18738
+ value: imapPassword,
18739
+ onChange: (e) => setImapPassword(e.target.value)
18740
+ }
18741
+ )
18742
+ ] }),
18743
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18744
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { htmlFor: "smtp-host", children: [
18745
+ "SMTP Host ",
18746
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { opacity: 0.6, fontWeight: 400 }, children: "\u2014 sending" })
18747
+ ] }),
18748
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18749
+ "input",
18750
+ {
18751
+ id: "smtp-host",
18752
+ type: "text",
18753
+ placeholder: "e.g. smtp.gmail.com \u2014 leave empty to disable sending",
18754
+ value: smtpHost,
18755
+ onChange: (e) => setSmtpHost(e.target.value)
18756
+ }
18757
+ )
18758
+ ] }),
18759
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18760
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "smtp-port", children: "SMTP Port" }),
18761
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18762
+ "input",
18763
+ {
18764
+ id: "smtp-port",
18765
+ type: "number",
18766
+ value: smtpPort,
18767
+ onChange: (e) => setSmtpPort(e.target.value)
18768
+ }
18769
+ )
18770
+ ] }),
18771
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", style: { display: "flex", alignItems: "center", gap: "8px", margin: "14px 0" }, children: [
18772
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18773
+ "input",
18774
+ {
18775
+ id: "smtp-secure",
18776
+ type: "checkbox",
18777
+ checked: smtpSecure,
18778
+ onChange: (e) => setSmtpSecure(e.target.checked),
18779
+ style: { width: "auto", cursor: "pointer" }
18780
+ }
18781
+ ),
18782
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "smtp-secure", style: { cursor: "pointer", fontWeight: 600, fontSize: "12px" }, children: "Use TLS (implicit, port 465) \u2014 leave off for 587/STARTTLS" })
18783
+ ] }),
18784
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18785
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "smtp-from", children: "From Address" }),
18786
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18787
+ "input",
18788
+ {
18789
+ id: "smtp-from",
18790
+ type: "text",
18791
+ placeholder: "defaults to the IMAP username",
18792
+ value: smtpFrom,
18793
+ onChange: (e) => setSmtpFrom(e.target.value)
18794
+ }
18795
+ )
18796
+ ] }),
18797
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18798
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "smtp-user", children: "SMTP Username" }),
18799
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18800
+ "input",
18801
+ {
18802
+ id: "smtp-user",
18803
+ type: "text",
18804
+ placeholder: "defaults to the IMAP username",
18805
+ value: smtpUser,
18806
+ onChange: (e) => setSmtpUser(e.target.value)
18807
+ }
18808
+ )
18809
+ ] }),
18810
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18811
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "smtp-password", children: "SMTP Password" }),
18812
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18813
+ "input",
18814
+ {
18815
+ id: "smtp-password",
18816
+ type: "password",
18817
+ placeholder: "defaults to the IMAP password",
18818
+ value: smtpPassword,
18819
+ onChange: (e) => setSmtpPassword(e.target.value)
18820
+ }
18821
+ )
18822
+ ] }),
18823
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18824
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "allowed-recipients", children: "Allowed Recipients" }),
18825
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18826
+ "input",
18827
+ {
18828
+ id: "allowed-recipients",
18829
+ type: "text",
18830
+ placeholder: "e.g. *@example.com, boss@corp.com \u2014 empty = anyone",
18831
+ value: allowedRecipients,
18832
+ onChange: (e) => setAllowedRecipients(e.target.value)
18833
+ }
18834
+ )
18835
+ ] }),
18836
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18837
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: "allowed-senders", children: "Allowed Senders" }),
18838
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18839
+ "input",
18840
+ {
18841
+ id: "allowed-senders",
18842
+ type: "text",
18843
+ placeholder: "e.g. *@example.com \u2014 inbound, not enforced yet",
18844
+ value: allowedSenders,
18845
+ onChange: (e) => setAllowedSenders(e.target.value)
18846
+ }
18847
+ )
18848
+ ] }),
18849
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-group", children: [
18850
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { children: "Agents allowed to use this account" }),
18851
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: "4px", marginTop: "4px" }, children: agents.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "11px", color: "var(--vscode-descriptionForeground)" }, children: "No agents configured yet." }) : agents.map((a) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: "8px", cursor: "pointer", fontWeight: 400, fontSize: "12px" }, children: [
18852
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18853
+ "input",
18854
+ {
18855
+ type: "checkbox",
18856
+ checked: allowedAgents.includes(a.id),
18857
+ onChange: (e) => setAllowedAgents(
18858
+ e.target.checked ? [...allowedAgents, a.id] : allowedAgents.filter((id) => id !== a.id)
18859
+ ),
18860
+ style: { width: "auto", cursor: "pointer" }
18861
+ }
18862
+ ),
18863
+ a.name
18864
+ ] }, a.id)) }),
18865
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: "11px", color: "var(--vscode-descriptionForeground)" }, children: "None selected = every agent may use it." })
18866
+ ] }),
18867
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "glass-form__help-card", style: {
18868
+ background: "rgba(255, 255, 255, 0.03)",
18869
+ border: "1px solid rgba(255, 255, 255, 0.05)",
18870
+ borderRadius: "var(--radius-md)",
18871
+ padding: "10px 12px",
18872
+ fontSize: "11px",
18873
+ marginTop: "12px",
18874
+ lineHeight: "1.4",
18875
+ color: "var(--vscode-descriptionForeground)"
18876
+ }, children: [
18877
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { children: [
18878
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Lightbulb, { size: 14 }),
18879
+ " Note:"
18880
+ ] }),
18881
+ " credentials are AES-256-GCM encrypted at rest. Gmail/Outlook accounts need an ",
18882
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "app password" }),
18883
+ ", not the account password. With an SMTP host set, agents can send through this account (",
18884
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { children: "mcp__email__*" }),
18885
+ " tools), and with an IMAP host they can read it.",
18886
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: " Allowed Recipients" }),
18887
+ " is the limit on where mail may go, an empty list means anyone; ",
18888
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "Allowed Senders" }),
18889
+ " is what limits who ",
18890
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { children: "email_fetch" }),
18891
+ " may read for the agent. Selecting no agent above leaves the account open to every one of them."
18892
+ ] })
18600
18893
  ] })
18601
18894
  ] }),
18602
18895
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "form-actions", children: [
18603
18896
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { className: "btn btn--secondary", onClick: cancelForm, children: "Cancel" }),
18604
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { className: "btn btn--primary", onClick: validateAndSave, children: "Save Task" })
18897
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { className: "btn btn--primary", onClick: validateAndSave, children: "Save Service" })
18605
18898
  ] })
18606
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "settings-list", children: tasks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "empty-message", children: "No scheduled tasks configured. Add a heartbeat task to run agents periodically." }) : tasks.map((task) => {
18899
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "settings-list", children: tasks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "empty-message", children: "No services configured. Add a heartbeat to run an agent periodically, a Telegram bot, or email credentials." }) : tasks.map((task) => {
18607
18900
  const agentName = agents.find((a) => a.id === task.agentId)?.name || task.agentId;
18608
18901
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "settings-card", children: [
18609
18902
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "settings-card__body", children: [
@@ -18627,7 +18920,7 @@ ${text}</tr>
18627
18920
  alignItems: "center",
18628
18921
  gap: "4px"
18629
18922
  },
18630
- title: "Toggle task active state",
18923
+ title: "Toggle service active state",
18631
18924
  children: task.enabled ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
18632
18925
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Circle, { size: 9, fill: "currentColor" }),
18633
18926
  " Active"
@@ -18646,6 +18939,18 @@ ${text}</tr>
18646
18939
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "Type:" }),
18647
18940
  " ",
18648
18941
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { children: "Telegram Poller" })
18942
+ ] }) : task.type === "email" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "settings-card__subtitle", style: { fontSize: "11px", marginTop: "4px" }, children: [
18943
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "Type:" }),
18944
+ " ",
18945
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { children: "Email" }),
18946
+ " \xB7 ",
18947
+ task.imapUser,
18948
+ " \xB7 IMAP ",
18949
+ task.imapHost,
18950
+ ":",
18951
+ task.imapPort,
18952
+ task.smtpHost ? ` \xB7 SMTP ${task.smtpHost}:${task.smtpPort}` : " \xB7 sending off",
18953
+ task.allowedAgents?.length ? ` \xB7 agents: ${task.allowedAgents.map((id) => agents.find((a) => a.id === id)?.name || id).join(", ")}` : " \xB7 any agent"
18649
18954
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
18650
18955
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "settings-card__subtitle", style: { fontSize: "11px", marginTop: "4px" }, children: [
18651
18956
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "Agent:" }),
@@ -18664,7 +18969,7 @@ ${text}</tr>
18664
18969
  ] })
18665
18970
  ] }),
18666
18971
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "settings-card__actions", children: [
18667
- task.type !== "telegram" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18972
+ task.type === "heartbeat" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
18668
18973
  "button",
18669
18974
  {
18670
18975
  className: "icon-btn",
@@ -18680,8 +18985,8 @@ ${text}</tr>
18680
18985
  {
18681
18986
  className: "icon-btn",
18682
18987
  onClick: () => startEdit(task),
18683
- title: "Edit task",
18684
- "aria-label": "Edit task",
18988
+ title: "Edit service",
18989
+ "aria-label": "Edit service",
18685
18990
  children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pencil, { size: 14 })
18686
18991
  }
18687
18992
  ),
@@ -18690,8 +18995,8 @@ ${text}</tr>
18690
18995
  {
18691
18996
  className: "icon-btn icon-btn--danger",
18692
18997
  onClick: () => deleteTask(task.id),
18693
- title: "Delete task",
18694
- "aria-label": "Delete task",
18998
+ title: "Delete service",
18999
+ "aria-label": "Delete service",
18695
19000
  children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Trash2, { size: 14 })
18696
19001
  }
18697
19002
  )
@@ -19522,9 +19827,9 @@ ${text}</tr>
19522
19827
  postMessage
19523
19828
  }
19524
19829
  );
19525
- case "scheduler":
19830
+ case "services":
19526
19831
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19527
- SchedulerTab,
19832
+ ServicesTab,
19528
19833
  {
19529
19834
  config,
19530
19835
  agents,
@@ -19597,9 +19902,9 @@ ${text}</tr>
19597
19902
  layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
19598
19903
  "button",
19599
19904
  {
19600
- className: `settings-panel__tab-btn ${activeTab === "scheduler" ? "settings-panel__tab-btn--active" : ""}`,
19601
- onClick: () => setActiveTab("scheduler"),
19602
- children: "Scheduler"
19905
+ className: `settings-panel__tab-btn ${activeTab === "services" ? "settings-panel__tab-btn--active" : ""}`,
19906
+ onClick: () => setActiveTab("services"),
19907
+ children: "Services"
19603
19908
  }
19604
19909
  ),
19605
19910
  layout === "sidebar" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(