agent-loft 0.2.48 → 0.2.49

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 (52) hide show
  1. package/README.md +26 -12
  2. package/package.json +1 -1
  3. package/src/agents/claude/driver.ts +1 -1
  4. package/src/agents/claude/session.ts +140 -47
  5. package/src/agents/codex/driver.ts +1 -1
  6. package/src/agents/codex/session.ts +90 -58
  7. package/src/channels/feishu/bot.ts +1 -3
  8. package/src/channels/feishu/cards.ts +2 -2
  9. package/src/channels/web/api.ts +24 -17
  10. package/src/channels/web/experts-api.ts +185 -0
  11. package/src/channels/web/skills-api.ts +1 -7
  12. package/src/channels/web/tasks-api.ts +9 -5
  13. package/src/core/command-catalog.ts +4 -6
  14. package/src/core/commands.ts +6 -11
  15. package/src/core/expert-prompt.ts +119 -0
  16. package/src/core/experts.ts +416 -0
  17. package/src/core/hub.ts +134 -102
  18. package/src/core/mcp.ts +253 -0
  19. package/src/core/memory-curator.ts +8 -9
  20. package/src/core/memory.ts +11 -4
  21. package/src/core/personal.ts +5 -1
  22. package/src/core/skill-runtime.ts +11 -114
  23. package/src/core/store.ts +30 -11
  24. package/src/core/task-prompt.ts +1 -1
  25. package/src/core/task-runner.ts +24 -11
  26. package/src/core/tasks-bridge.ts +7 -7
  27. package/src/core/tasks.ts +49 -14
  28. package/src/core/types.ts +4 -7
  29. package/src/core/uploads.ts +7 -7
  30. package/src/mcp/tasks-server.ts +1 -2
  31. package/web/css/experts.css +103 -0
  32. package/web/css/messages.css +43 -0
  33. package/web/css/overlay.css +12 -0
  34. package/web/css/sidebar.css +3 -2
  35. package/web/css/skills.css +0 -11
  36. package/web/css/topbar.css +2 -2
  37. package/web/index.html +1 -0
  38. package/web/settings/experts.js +444 -0
  39. package/web/settings/index.js +3 -0
  40. package/web/settings/memory.js +21 -5
  41. package/web/settings/skills.js +3 -3
  42. package/web/state.js +5 -2
  43. package/web/views/composer.js +4 -16
  44. package/web/views/conv-actions.js +7 -9
  45. package/web/views/experts.js +73 -0
  46. package/web/views/layout.js +4 -3
  47. package/web/views/messages.js +44 -11
  48. package/web/views/sidebar.js +2 -2
  49. package/web/views/tasks.js +21 -36
  50. package/web/views/topbar.js +43 -74
  51. package/src/core/chat-mode.ts +0 -62
  52. package/web/views/mention.js +0 -202
@@ -6,7 +6,8 @@
6
6
  // - 对话没在忙、也没挂着授权 / 提问:忙的话等它(最多 WAIT_MAX_MS),不能插进别人正在进行的那一轮,
7
7
  // 更不能被当成对挂着的提问的回答。
8
8
  import crypto from "node:crypto";
9
- import { config, resolveWorkspacePath } from "./config.js";
9
+ import { resolveWorkspacePath } from "./config.js";
10
+ import { getExpert } from "./experts.js";
10
11
  import { hub, type TaskTurnEnd } from "./hub.js";
11
12
  import { interactions } from "./interactions.js";
12
13
  import { memoryOwnerOf } from "./personal.js";
@@ -49,31 +50,43 @@ type Resolved = { key: string } | { pause: string } | { error: string };
49
50
 
50
51
  /** 这次该发到哪条对话;专用对话还没有(或者被删了)就新建一条 */
51
52
  function resolveConv(task: Task): Resolved {
53
+ const missingExpert = (id: string | undefined) => !!id && getExpert(id)?.owner !== task.owner;
54
+ const deletedExpert = { pause: "任务用的专家已经删除了,任务已暂停。编辑任务换一个专家再启用。" };
52
55
  if (task.target.kind === "conv") {
53
56
  const conv = getConversation(task.target.key);
54
57
  if (!conv || conv.hidden) return { pause: "回复的那条对话已经被删除,任务已暂停。可以改成「专用对话」后再启用。" };
55
58
  if (ownerOf(conv) !== task.owner) return { pause: "回复的那条对话已经不属于你了,任务已暂停。" };
59
+ if (missingExpert(conv.expert)) return deletedExpert;
56
60
  return { key: conv.key };
57
61
  }
62
+ // 复用专用对话前也要检查,不能等到新建对话时才发现专家已删除。
63
+ if (missingExpert(task.expert)) return deletedExpert;
58
64
  const existing = task.target.key ? getConversation(task.target.key) : undefined;
59
- if (existing && !existing.hidden && existing.taskId === task.id && ownerOf(existing) === task.owner) return { key: existing.key };
65
+ if (existing && !existing.hidden && existing.taskId === task.id && ownerOf(existing) === task.owner) return missingExpert(existing.expert) ? deletedExpert : { key: existing.key };
60
66
 
67
+ // 专家被删了:不能换成别的专家去跑(权限可能大得多),暂停等用户改
68
+ const expert = task.expert ? getExpert(task.expert) : undefined;
61
69
  const enabled = hub.enabledAgents().map((d) => d.id);
62
70
  if (!enabled.includes(task.agent)) return { error: `${hub.label(task.agent)} 没有启用` };
63
71
  let cwd: string | null = null;
64
- if (task.cwd) {
65
- cwd = resolveWorkspacePath(task.cwd);
66
- if (!cwd) return { error: `工作目录 ${task.cwd} 不存在了(或者不在工作区里),改一下任务的目录` };
72
+ const wantCwd = task.cwd || expert?.cwd;
73
+ if (wantCwd) {
74
+ cwd = resolveWorkspacePath(wantCwd);
75
+ if (!cwd) return { error: `工作目录 ${wantCwd} 不存在了(或者不在工作区里),改一下任务的目录` };
67
76
  }
68
77
  const key = `web:${crypto.randomBytes(6).toString("hex")}`;
69
78
  // 侧栏里专用对话前面有时钟图标(taskId),标题不用再加
70
- hub.ensure({ key, channel: "web", channelId: "web", defaultAgent: task.agent, owner: task.owner, title: task.title.slice(0, 80) });
71
- updateConversation(key, {
72
- titleAuto: false,
73
- taskId: task.id,
74
- ...(task.mode === "chat" ? { mode: "chat" as const } : {}),
75
- ...(cwd && cwd !== config().workspaceRoot ? { cwd, cwdExplicit: true } : {}),
79
+ hub.ensure({
80
+ key,
81
+ channel: "web",
82
+ channelId: "web",
83
+ defaultAgent: task.agent,
84
+ ...(task.expert ? { expert: task.expert } : {}),
85
+ ...(cwd ? { cwd } : {}),
86
+ owner: task.owner,
87
+ title: task.title.slice(0, 80),
76
88
  });
89
+ updateConversation(key, { titleAuto: false, taskId: task.id });
77
90
  if (task.model || task.effort) {
78
91
  updateAgentBinding(key, task.agent, { ...(task.model ? { model: task.model } : {}), ...(task.effort ? { effort: task.effort } : {}) });
79
92
  }
@@ -13,7 +13,7 @@ import { config } from "./config.js";
13
13
  import { hub } from "./hub.js";
14
14
  import { interactions } from "./interactions.js";
15
15
  import { memoryOwnerOf } from "./personal.js";
16
- import { getConversation } from "./store.js";
16
+ import { expertIdOf, getConversation } from "./store.js";
17
17
  import { forgetTask } from "./task-runner.js";
18
18
  import { describeSchedule, formatDateTime, nextRun, normalizeSchedule, parseLocalDateTime, serverTimeZone, type TaskSchedule } from "./task-schedule.js";
19
19
  import { TASK_TOOL_TIMEOUT_SEC, tasksSocketPath, verifyTaskCaller } from "./tasks-mcp.js";
@@ -66,7 +66,7 @@ async function confirm(convKey: string, title: string, detail: string): Promise<
66
66
  return outcome.settlement === "allow-once" || outcome.settlement === "allow-always" || outcome.settlement === "allow-session";
67
67
  }
68
68
 
69
- function card(fields: { schedule?: TaskSchedule; notify?: string; where?: string; mode?: string; prompt?: string; enabled?: boolean }, now: number): string {
69
+ function card(fields: { schedule?: TaskSchedule; notify?: string; where?: string; expert?: string; prompt?: string; enabled?: boolean }, now: number): string {
70
70
  const lines: string[] = [];
71
71
  if (fields.schedule) {
72
72
  const next = nextRun(fields.schedule, now);
@@ -75,7 +75,7 @@ function card(fields: { schedule?: TaskSchedule; notify?: string; where?: string
75
75
  }
76
76
  if (fields.notify) lines.push(`**提醒**:${fields.notify === "always" ? "每次都提醒" : "有需要才提醒(由 agent 判断)"}`);
77
77
  if (fields.where) lines.push(`**结果发到**:${fields.where}`);
78
- if (fields.mode) lines.push(`**模式**:${fields.mode === "work" ? "工作模式(能执行命令、读写文件)" : "聊天模式(只能联网搜索)"}`);
78
+ if (fields.expert) lines.push(`**专家**:${fields.expert}`);
79
79
  if (fields.enabled !== undefined) lines.push(`**状态**:${fields.enabled ? "恢复运行" : "暂停"}`);
80
80
  if (fields.prompt) lines.push("", "**到点要做的事**:", "", ...fields.prompt.split("\n").map((l) => `> ${l}`));
81
81
  return lines.join("\n");
@@ -111,22 +111,22 @@ async function call(userId: string, convKey: string, tool: string, args: Record<
111
111
  const prompt = String(args.prompt ?? "").trim();
112
112
  if (!prompt) return fail("prompt 不能为空。");
113
113
  const dedicated = args.reply_to === "dedicated";
114
- const mode = dedicated ? (args.mode === "work" ? "work" : "chat") : (conv.mode ?? "work");
114
+ // 专用对话也用这条对话的专家
115
+ const expertName = hub.expertBadge(conv).name;
115
116
  const input: TaskInput = {
116
117
  title: args.title,
117
118
  prompt,
118
119
  schedule,
119
120
  notify: args.notify === "always" ? "always" : "smart",
120
121
  target: dedicated ? { kind: "dedicated" } : { kind: "conv", key: convKey },
121
- agent: conv.agent,
122
+ expert: expertIdOf(conv),
122
123
  cwd: conv.cwd,
123
- mode,
124
124
  };
125
125
  const title = String(args.title ?? "").trim() || prompt.replace(/\s+/g, " ").slice(0, 60);
126
126
  const ok = await confirm(
127
127
  convKey,
128
128
  `新建定时任务「${title}」`,
129
- card({ schedule, notify: String(input.notify), where: dedicated ? "单独开一条对话" : "这条对话", ...(dedicated ? { mode } : {}), prompt }, now),
129
+ card({ schedule, notify: String(input.notify), where: dedicated ? "单独开一条对话" : "这条对话", ...(dedicated ? { expert: expertName } : {}), prompt }, now),
130
130
  );
131
131
  if (!ok) return fail("用户没有同意,任务没有建。");
132
132
  try {
package/src/core/tasks.ts CHANGED
@@ -10,12 +10,12 @@ import path from "node:path";
10
10
  import { EventEmitter } from "node:events";
11
11
  import { dataDir, readJson, writeJsonAtomic } from "../home.js";
12
12
  import { describeSchedule, nextRun, normalizeSchedule, type TaskSchedule } from "./task-schedule.js";
13
- import type { ConversationMode } from "./types.js";
13
+ import { canUseExpert, getExpert, isBuiltin } from "./experts.js";
14
14
 
15
15
  /**
16
16
  * 结果回到哪:
17
- * conv:一条已有的对话(agent 在对话里帮你建的,默认回到那条对话),模式 / agent / 目录都跟着那条对话;
18
- * dedicated:任务自己的对话,第一次运行时新建(key 记下来,之后续用),模式等按任务里的设置。
17
+ * conv:一条已有的对话(agent 在对话里帮你建的,默认回到那条对话),专家 / 目录都跟着那条对话;
18
+ * dedicated:任务自己的对话,第一次运行时新建(key 记下来,之后续用),专家等按任务里的设置。
19
19
  */
20
20
  export type TaskTarget = { kind: "conv"; key: string } | { kind: "dedicated"; key?: string };
21
21
 
@@ -42,10 +42,10 @@ export type Task = {
42
42
  /** smart:只在需要时提醒(agent 判断);always:每次都提醒 */
43
43
  notify: "smart" | "always";
44
44
  target: TaskTarget;
45
- /** 专用对话的设置(target 是 conv 时不用,以那条对话为准) */
45
+ /** 专用对话的设置(target 是 conv 时不用,以那条对话为准)。agent 是引擎;expert 是自定义专家的 id,没有就是内置专家 agent */
46
46
  agent: string;
47
+ expert?: string;
47
48
  cwd?: string;
48
- mode: ConversationMode;
49
49
  model?: string;
50
50
  effort?: string;
51
51
  enabled: boolean;
@@ -70,10 +70,32 @@ const storePath = path.join(dataDir, "tasks.json");
70
70
  let cache: Task[] | null = null;
71
71
 
72
72
  function load(): Task[] {
73
- cache ??= readJson<Task[]>(storePath, []).filter((t) => t && typeof t.id === "string" && typeof t.owner === "string" && t.schedule);
73
+ if (cache) return cache;
74
+ cache = readJson<Task[]>(storePath, []).filter((t) => t && typeof t.id === "string" && typeof t.owner === "string" && t.schedule);
75
+ // 聊天模式取消了(换成了专家):以前聊天模式的专用对话已经丢掉,任务先暂停,等用户选个专家再启用 ——
76
+ // 不能悄悄换成内置专家去跑(那是能执行命令的)
77
+ let changed = false;
78
+ for (const t of cache) {
79
+ const legacy = t as Task & { mode?: string };
80
+ if (legacy.mode === undefined) continue;
81
+ if (legacy.mode === "chat" && t.target.kind === "dedicated") {
82
+ t.enabled = false;
83
+ delete t.nextRunAt;
84
+ t.target = { kind: "dedicated" };
85
+ t.runs.unshift({ id: `r_${crypto.randomBytes(4).toString("hex")}`, at: Date.now(), endedAt: Date.now(), status: "skipped", note: "聊天模式已取消:编辑任务选一个专家,再启用" });
86
+ }
87
+ delete legacy.mode;
88
+ changed = true;
89
+ }
90
+ if (changed) writeJsonAtomic(storePath, cache);
74
91
  return cache;
75
92
  }
76
93
 
94
+ /** 任务的专家 id:自定义专家的 id,或者内置专家(就是 agent 本身) */
95
+ export function taskExpertId(t: Pick<Task, "agent" | "expert">): string {
96
+ return t.expert ?? t.agent;
97
+ }
98
+
77
99
  function save(owner?: string): void {
78
100
  writeJsonAtomic(storePath, load());
79
101
  if (owner) taskEvents.emit("changed", owner);
@@ -112,9 +134,10 @@ export type TaskInput = {
112
134
  schedule?: unknown;
113
135
  notify?: unknown;
114
136
  target?: unknown;
137
+ /** 专家 id(内置的 claude / codex,或者自定义专家)。agent 是以前的叫法,照样认 */
138
+ expert?: unknown;
115
139
  agent?: unknown;
116
140
  cwd?: unknown;
117
- mode?: unknown;
118
141
  model?: unknown;
119
142
  effort?: unknown;
120
143
  enabled?: unknown;
@@ -134,6 +157,14 @@ function cleanPrompt(v: unknown): string {
134
157
  return p;
135
158
  }
136
159
 
160
+ /** 选的专家 → 引擎 + 自定义专家 id。只能选内置的或自己的 */
161
+ function cleanExpert(owner: string, v: unknown): { agent: string; expert?: string } {
162
+ const id = str(v) || "claude";
163
+ if (!canUseExpert(owner, id)) throw new Error("这个专家不存在");
164
+ if (isBuiltin(id)) return { agent: id };
165
+ return { agent: getExpert(id)!.engine, expert: id };
166
+ }
167
+
137
168
  function cleanTarget(v: unknown, prev?: TaskTarget): TaskTarget {
138
169
  const r = (v ?? {}) as Record<string, unknown>;
139
170
  if (r.kind === "conv" && typeof r.key === "string" && r.key) return { kind: "conv", key: r.key };
@@ -145,7 +176,7 @@ export function createTask(owner: string, input: TaskInput, by: "user" | "agent"
145
176
  if (listTasks(owner).length >= TASKS_PER_USER) throw new Error(`每人最多 ${TASKS_PER_USER} 个定时任务,先删掉几个不用的`);
146
177
  const prompt = cleanPrompt(input.prompt);
147
178
  const schedule = normalizeSchedule(input.schedule, now);
148
- const agent = str(input.agent) || "claude";
179
+ const picked = cleanExpert(owner, input.expert ?? input.agent);
149
180
  const task: Task = {
150
181
  id: `t_${crypto.randomBytes(5).toString("hex")}`,
151
182
  owner,
@@ -154,9 +185,8 @@ export function createTask(owner: string, input: TaskInput, by: "user" | "agent"
154
185
  schedule,
155
186
  notify: input.notify === "always" ? "always" : "smart",
156
187
  target: cleanTarget(input.target),
157
- agent,
188
+ ...picked,
158
189
  ...(str(input.cwd) ? { cwd: str(input.cwd) } : {}),
159
- mode: input.mode === "work" ? "work" : "chat",
160
190
  ...(str(input.model) ? { model: str(input.model) } : {}),
161
191
  ...(str(input.effort) ? { effort: str(input.effort) } : {}),
162
192
  enabled: input.enabled !== false,
@@ -181,23 +211,28 @@ export function updateTask(owner: string, id: string, patch: TaskInput, now = Da
181
211
  if (patch.schedule !== undefined) next.schedule = normalizeSchedule(patch.schedule, now);
182
212
  if (patch.notify !== undefined) next.notify = patch.notify === "always" ? "always" : "smart";
183
213
  if (patch.target !== undefined) next.target = cleanTarget(patch.target, task.target);
184
- if (patch.agent !== undefined && str(patch.agent)) next.agent = str(patch.agent);
214
+ const pick = patch.expert ?? patch.agent;
215
+ if (pick !== undefined && str(pick)) {
216
+ const picked = cleanExpert(owner, pick);
217
+ next.agent = picked.agent;
218
+ if (picked.expert) next.expert = picked.expert;
219
+ else delete next.expert;
220
+ }
185
221
  if (patch.cwd !== undefined) {
186
222
  if (str(patch.cwd)) next.cwd = str(patch.cwd);
187
223
  else delete next.cwd;
188
224
  }
189
- if (patch.mode !== undefined) next.mode = patch.mode === "work" ? "work" : "chat";
190
225
  for (const k of ["model", "effort"] as const) {
191
226
  if (patch[k] === undefined) continue;
192
227
  if (str(patch[k])) next[k] = str(patch[k]);
193
228
  else delete next[k];
194
229
  }
195
230
  if (patch.enabled !== undefined) next.enabled = patch.enabled !== false;
196
- // 专用对话的 agent / 目录 / 模式变了:旧的那条对话对不上了,下次新开一条
231
+ // 专用对话的专家 / 目录变了:旧的那条对话对不上了(对话中途不能换专家),下次新开一条
197
232
  if (
198
233
  next.target.kind === "dedicated" &&
199
234
  next.target.key &&
200
- (next.agent !== task.agent || next.cwd !== task.cwd || next.mode !== task.mode)
235
+ (next.agent !== task.agent || next.expert !== task.expert || next.cwd !== task.cwd)
201
236
  ) {
202
237
  next.target = { kind: "dedicated" };
203
238
  }
package/src/core/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // 核心类型:渠道(飞书 / Web / 以后的 Telegram)与 agent(Claude / Codex / 以后的 ACP)
2
2
  // 之间只通过这里的类型说话。渠道不认识 Claude,agent 不认识飞书。
3
3
  import type { AgentCommand } from "./command-catalog.js";
4
+ import type { ExpertRuntime } from "./experts.js";
4
5
 
5
6
  // ---------- 用户输入 ----------
6
7
 
@@ -196,10 +197,10 @@ export type SessionOptions = {
196
197
  /** 工作目录内改文件不再询问(/autoedit)。Bash 等照常询问 */
197
198
  autoEdit?: boolean;
198
199
  /**
199
- * chat:聊天模式 —— 换成精简的系统提示,只留联网搜索,不加载技能 / MCP / 插件,不能执行命令、
200
- * 不能读写本地文件,每轮的固定开销小得多。不给就是 work(agent 原装的样子)。
200
+ * 自定义专家(core/experts.ts):提示词、权限、技能、MCP、子智能体都按它来。
201
+ * 不给就是内置专家 —— agent 原装的样子(原装提示词、机器上的技能和 MCP、所有工具)。
201
202
  */
202
- mode?: ConversationMode;
203
+ expert?: ExpertRuntime;
203
204
  /** 这条对话主人的记忆:prompt 拼进系统提示,userId 交给记忆工具(记给谁由这里定死) */
204
205
  memory?: {
205
206
  userId: string;
@@ -209,8 +210,6 @@ export type SessionOptions = {
209
210
  /** 当前对话,搜索时跳过 */
210
211
  convKey?: string;
211
212
  };
212
- /** 模式换过、这个 agent 会话还不知道:换不了系统提示的 agent(Codex)要在第一条消息里说一声 */
213
- announceMode?: boolean;
214
213
  /**
215
214
  * 给 agent 定时任务工具(core/tasks-mcp.ts):替谁、在哪条对话里管理。只有有主人的对话才给。
216
215
  * 技能工具(让 agent 帮用户建、改技能)也跟着它一起给。
@@ -234,8 +233,6 @@ export type SessionSkills = {
234
233
  prompt?: string;
235
234
  };
236
235
 
237
- export type ConversationMode = "chat" | "work";
238
-
239
236
  /**
240
237
  * 中断的方式。默认(停止):这一轮和排着队的都不要了。
241
238
  * keepQueue(打断并发送):只停这一轮,排着的留着;给了 first 就把它挪到最前面,这一轮一结束就轮到它
@@ -244,12 +244,12 @@ export function uploadKeyOf(file: string): string | undefined {
244
244
 
245
245
  /**
246
246
  * 附件清单的文字说明,两个 agent 都用它告诉模型文件在哪。
247
- * chat:聊天模式,agent 没有读文件的工具 —— 没能放进消息里的附件要说清楚读不了。
247
+ * noRead:专家只能联网、没有读文件的工具 —— 没能放进消息里的附件要说清楚读不了。
248
248
  */
249
249
  export function describeAttachments(
250
250
  saved: SavedAttachment[],
251
251
  inlined: (a: SavedAttachment) => boolean,
252
- chat = false,
252
+ noRead = false,
253
253
  ): string {
254
254
  const counters: Partial<Record<AttachmentKind, number>> = {};
255
255
  const lines = saved.map((a) => {
@@ -257,19 +257,19 @@ export function describeAttachments(
257
257
  const details = [
258
258
  formatSize(a.size),
259
259
  ...(a.durationMs ? [`时长 ${Math.round(a.durationMs / 1000)} 秒`] : []),
260
- ...(inlined(a) ? ["内容已附在本消息中"] : chat ? ["聊天模式下读不了这个文件"] : []),
260
+ ...(inlined(a) ? ["内容已附在本消息中"] : noRead ? ["你读不了这个文件"] : []),
261
261
  ];
262
262
  return `- ${KIND_LABEL[a.kind]}${n}:${a.path}(${details.join(",")})`;
263
263
  });
264
- const head = chat
265
- ? "[用户发来了以下附件。现在是聊天模式,没有读文件的工具:读不了的附件请告诉用户发 /work 切到工作模式再处理]"
264
+ const head = noRead
265
+ ? "[用户发来了以下附件。你没有读文件的工具:读不了的附件请告诉用户换一个能读文件的专家(新开对话时选)再处理]"
266
266
  : "[用户发来了以下附件,已保存到本地,需要时可以直接读取或处理这些文件]";
267
267
  return [head, ...lines].join("\n");
268
268
  }
269
269
 
270
- // ---------- 聊天模式:文本附件直接放进消息 ----------
270
+ // ---------- 只能联网的专家:文本附件直接放进消息 ----------
271
271
  //
272
- // 聊天模式不给 agent 读本地文件的工具(它能联网,能读文件就能被网页里的提示注入骗着把文件内容带出去),
272
+ // 只能联网的专家没有读本地文件的工具(它能联网,能读文件就能被网页里的提示注入骗着把文件内容带出去),
273
273
  // 所以文本类的附件由我们读出来,跟着消息一起发过去。
274
274
 
275
275
  const TEXT_EXT =
@@ -64,9 +64,8 @@ const TOOLS = [
64
64
  reply_to: {
65
65
  type: "string",
66
66
  enum: ["this_conversation", "dedicated"],
67
- description: "this_conversation:结果回到当前对话(默认);dedicated:给任务单独开一条对话(可以指定 mode)",
67
+ description: "this_conversation:结果回到当前对话(默认);dedicated:给任务单独开一条对话(和当前对话用同一个专家)",
68
68
  },
69
- mode: { type: "string", enum: ["chat", "work"], description: "dedicated 时用:chat 只能联网搜索、开销小(默认);work 能执行命令、读写本机文件" },
70
69
  },
71
70
  required: ["prompt", "schedule"],
72
71
  additionalProperties: false,
@@ -0,0 +1,103 @@
1
+ /* ---- 专家 / MCP 设置页(列表沿用技能页的卡片样式) ---- */
2
+
3
+ /* 一行放几个短字段:名字 + 图标,引擎 + 模型 + 思考程度 */
4
+ .expert-form .row-fields {
5
+ display: flex;
6
+ gap: 12px;
7
+ }
8
+
9
+ .expert-form .row-fields > .field {
10
+ flex: 1;
11
+ min-width: 0;
12
+ }
13
+
14
+ .expert-form .row-fields > .field:has(input.narrow) {
15
+ flex: 0 0 120px;
16
+ }
17
+
18
+ /* 勾选列表:技能、MCP、子智能体、记忆整理选专家 */
19
+ .check-list {
20
+ display: flex;
21
+ flex-direction: column;
22
+ gap: 6px;
23
+ max-height: 220px;
24
+ overflow: auto;
25
+ padding: 8px 10px;
26
+ border: 1px solid var(--border);
27
+ border-radius: 10px;
28
+ }
29
+
30
+ .check-list.inline {
31
+ flex-direction: row;
32
+ flex-wrap: wrap;
33
+ gap: 16px;
34
+ max-height: none;
35
+ border: none;
36
+ padding: 0;
37
+ }
38
+
39
+ .check-item {
40
+ display: flex;
41
+ align-items: baseline;
42
+ gap: 8px;
43
+ font-size: 14px;
44
+ cursor: pointer;
45
+ min-width: 0;
46
+ }
47
+
48
+ .check-item small {
49
+ color: var(--fg-faint);
50
+ font-size: 12px;
51
+ overflow: hidden;
52
+ text-overflow: ellipsis;
53
+ white-space: nowrap;
54
+ min-width: 0;
55
+ }
56
+
57
+ /* MCP 的环境变量 / 请求头:名字、值、密钥、删除排一行 */
58
+ .pairs {
59
+ display: flex;
60
+ flex-direction: column;
61
+ gap: 6px;
62
+ margin-bottom: 6px;
63
+ }
64
+
65
+ .pair-row {
66
+ display: flex;
67
+ align-items: center;
68
+ gap: 8px;
69
+ }
70
+
71
+ .field .pair-row input:not([type="checkbox"]) {
72
+ flex: 1;
73
+ min-width: 0;
74
+ }
75
+
76
+ .field .pair-row input:first-child {
77
+ flex: 0 0 34%;
78
+ }
79
+
80
+ .task-meta .mono {
81
+ font-family: var(--mono);
82
+ font-size: 12px;
83
+ overflow: hidden;
84
+ text-overflow: ellipsis;
85
+ white-space: nowrap;
86
+ max-width: 320px;
87
+ }
88
+
89
+ @media (max-width: 640px) {
90
+ .expert-form .row-fields {
91
+ flex-direction: column;
92
+ gap: 14px;
93
+ }
94
+
95
+ .expert-form .row-fields > .field:has(input.narrow) {
96
+ flex: 1;
97
+ }
98
+ }
99
+
100
+ /* 按类型切换的一组字段:和别的字段一样排(间距由 .task-form 给) */
101
+ .field-group {
102
+ display: contents;
103
+ }
@@ -92,6 +92,49 @@
92
92
  height: 64px;
93
93
  }
94
94
 
95
+ /* 自定义专家的 emoji 图标 */
96
+ .hero-logo.expert-emoji {
97
+ font-size: 56px;
98
+ line-height: 1;
99
+ color: inherit;
100
+ }
101
+
102
+ .agent-icon.expert-emoji {
103
+ font-size: 15px;
104
+ line-height: 1;
105
+ width: 18px;
106
+ justify-content: center;
107
+ }
108
+
109
+ .hero-sub {
110
+ color: var(--fg-soft);
111
+ font-size: 14px;
112
+ margin-top: -10px;
113
+ }
114
+
115
+ /* 专家的快捷提问:点一下填进输入框 */
116
+ .hero-prompts {
117
+ display: flex;
118
+ flex-wrap: wrap;
119
+ justify-content: center;
120
+ gap: 8px;
121
+ max-width: 640px;
122
+ }
123
+
124
+ .hero-prompt {
125
+ border: 1px solid var(--border);
126
+ background: var(--bg);
127
+ color: var(--fg);
128
+ border-radius: 999px;
129
+ padding: 6px 14px;
130
+ font-size: 13px;
131
+ cursor: pointer;
132
+ }
133
+
134
+ .hero-prompt:hover {
135
+ background: var(--bg-hover);
136
+ }
137
+
95
138
  .empty.hero h2 {
96
139
  font-size: clamp(22px, 4.2vw, 36px);
97
140
  font-weight: 400;
@@ -435,3 +435,15 @@ button.list-item:hover {
435
435
  max-width: 90vw;
436
436
  white-space: pre-wrap;
437
437
  }
438
+
439
+ /* 选专家:说明不要太长 */
440
+ .popover.expert-pop {
441
+ max-width: 340px;
442
+ }
443
+
444
+ .popover.expert-pop .pop-item .s {
445
+ display: -webkit-box;
446
+ -webkit-line-clamp: 2;
447
+ -webkit-box-orient: vertical;
448
+ overflow: hidden;
449
+ }
@@ -329,8 +329,9 @@ button.conv-group:hover {
329
329
  display: none;
330
330
  }
331
331
 
332
- .conv-item .chat-mark {
333
- color: var(--fg-soft);
332
+ .conv-item .expert-mark {
333
+ font-size: 13px;
334
+ line-height: 1;
334
335
  }
335
336
 
336
337
  /* ---- 侧栏底部的额度 ---- */
@@ -337,17 +337,6 @@
337
337
  margin-top: 14px;
338
338
  }
339
339
 
340
- /* @ 补全:在弹窗里的输入框下面弹出 */
341
- .mention-wrap {
342
- position: relative;
343
- }
344
-
345
- .slash-menu.below {
346
- top: calc(100% + 4px);
347
- bottom: auto;
348
- max-height: 240px;
349
- }
350
-
351
340
  @media (max-width: 640px) {
352
341
  .skills-page .tasks-head {
353
342
  flex-direction: column;
@@ -155,14 +155,14 @@
155
155
  gap: 6px;
156
156
  }
157
157
 
158
- .top-title .conv-mode-icon {
158
+ .top-title .conv-expert-icon {
159
159
  display: inline-grid;
160
160
  flex-shrink: 0;
161
161
  margin-left: 4px;
162
162
  color: var(--fg-soft);
163
163
  }
164
164
 
165
- .top-title .conv-mode-icon svg {
165
+ .top-title .conv-expert-icon svg {
166
166
  width: 16px;
167
167
  height: 16px;
168
168
  }
package/web/index.html CHANGED
@@ -27,6 +27,7 @@
27
27
  <link rel="stylesheet" href="/css/todos.css" />
28
28
  <link rel="stylesheet" href="/css/tasks.css" />
29
29
  <link rel="stylesheet" href="/css/skills.css" />
30
+ <link rel="stylesheet" href="/css/experts.css" />
30
31
  <link rel="stylesheet" href="/css/terminal.css" />
31
32
  <link rel="stylesheet" href="/css/remote.css" />
32
33
  <link rel="stylesheet" href="/css/servers.css" />