agent-loft 0.2.31 → 0.2.32

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.
@@ -8,6 +8,7 @@ import { agentLabel, closeSide, renderSidebar } from "./sidebar.js";
8
8
  import { baseName, renderTopbar, usableAgents } from "./topbar.js";
9
9
  import { openConversation } from "./messages.js";
10
10
  import { changeCwd } from "./conv-actions.js";
11
+ import { attachMention } from "./mention.js";
11
12
 
12
13
  // ---------- 定时任务页 ----------
13
14
  // 到点让 agent 按提示词干活,结果回到一条对话里;「有需要才提醒」时由 agent 判断这次要不要打扰你。
@@ -281,8 +282,16 @@ export function openTaskForm(task, preset) {
281
282
  const src = task ?? preset ?? {};
282
283
  const agents = usableAgents();
283
284
  const title = h("input", { value: src.title ?? "", maxlength: "60", placeholder: "比如:检查 agent-loft 更新" });
284
- const prompt = h("textarea", { rows: 5, maxlength: "4000", placeholder: "到点让 agent 做什么。写成完整的指令:那时你多半不在,它没法再问你。" });
285
+ const prompt = h("textarea", { rows: 5, maxlength: "4000", placeholder: "到点让 agent 做什么。写成完整的指令:那时你多半不在,它没法再问你。可以用 @ 指定技能。" });
285
286
  prompt.value = src.prompt ?? "";
287
+ // @ 技能:和输入框一样,到点时服务端认提示词里的 @name
288
+ const mentionMenu = h("div", { class: "slash-menu below", hidden: true });
289
+ const mention = attachMention(prompt, mentionMenu);
290
+ prompt.addEventListener("input", () => void mention.update());
291
+ prompt.addEventListener("blur", () => setTimeout(mention.close, 150));
292
+ prompt.addEventListener("keydown", (e) => {
293
+ if (mention.keydown(e)) e.preventDefault();
294
+ });
286
295
 
287
296
  // ---- 频率 ----
288
297
  const sch = { kind: "daily", time: "09:00", days: [1], day: 1, every: 2, minute: 0, expr: "0 9 * * *", at: Date.now() + 3600_000, ...(src.schedule ?? {}) };
@@ -405,7 +414,7 @@ export function openTaskForm(task, preset) {
405
414
  "div",
406
415
  { class: "modal-body task-form" },
407
416
  field("名称", title),
408
- field("要做的事", prompt, "需要对比的写清楚怎么判断,比如「和上次的结果比」「版本号比当前的新才算更新」。"),
417
+ field("要做的事", h("div", { class: "mention-wrap" }, prompt, mentionMenu), "需要对比的写清楚怎么判断,比如「和上次的结果比」「版本号比当前的新才算更新」。输入 @ 可以指定这次要用的技能。"),
409
418
  field("频率", h("div", { class: "task-freq-row" }, freq, freqBox), freqHint),
410
419
  field("提醒", notify),
411
420
  target ? field("结果发到", target) : field("结果发到", h("div", { class: "task-static" }, task?.convKey ? `专用对话「${task.convTitle || "对话"}」` : "专用对话(第一次运行时新建,之后都发到这条)")),
@@ -12,14 +12,14 @@ import { changeCwd, deleteConv, doAction, forkConversation, openModelPicker, ren
12
12
 
13
13
  export function renderTopbar() {
14
14
  const c = S.current ? S.convs.get(S.current) : null;
15
- // 定时任务页:只有标题,模式切换、「更多」都是对话用的
16
- const tasks = S.view === "tasks";
15
+ // 定时任务页、技能页:只有标题,模式切换、「更多」都是对话用的
16
+ const tasks = S.view === "tasks" || S.view === "skills";
17
17
  fill(ui.topbar,
18
18
  h("button", { class: "icon-btn menu-btn", onclick: openSide, title: "会话列表" }, icon("menu")),
19
19
  h(
20
20
  "div",
21
21
  { class: "top-title" },
22
- tasks ? h("span", { class: "conv-name" }, "定时任务") : c ? h("span", { class: "conv-name", title: convTitle(c) }, convTitle(c)) : null,
22
+ tasks ? h("span", { class: "conv-name" }, S.view === "skills" ? "技能" : "定时任务") : c ? h("span", { class: "conv-name", title: convTitle(c) }, convTitle(c)) : null,
23
23
  ),
24
24
  tasks ? null : ui.modeSlot,
25
25
  tasks ? null : h("button", { class: "icon-btn top-more", title: "更多", onclick: (e) => openTopMore(e.currentTarget) }, icon("more")),