agent-loft 0.2.57 → 0.2.58

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-loft",
3
- "version": "0.2.57",
3
+ "version": "0.2.58",
4
4
  "type": "module",
5
5
  "description": "多个 agent 的工作台:把本机 Claude Code / Codex 放到一处统一管理,用飞书和 Web 页面随时驱动——会话、审批、模型切换都共用",
6
6
  "keywords": [
@@ -64,6 +64,7 @@
64
64
 
65
65
  .settings-page .row > .grow {
66
66
  flex: 1;
67
+ min-width: 0;
67
68
  }
68
69
 
69
70
  .section {
@@ -266,6 +267,34 @@
266
267
  }
267
268
 
268
269
  /* 设置 → Agent:输入框可选模型 */
270
+ .model-check-summary {
271
+ display: flex;
272
+ align-items: center;
273
+ justify-content: space-between;
274
+ gap: 8px;
275
+ cursor: pointer;
276
+ list-style: none;
277
+ }
278
+
279
+ .model-check-summary::-webkit-details-marker {
280
+ display: none;
281
+ }
282
+
283
+ .model-check-summary svg {
284
+ width: 14px;
285
+ height: 14px;
286
+ flex-shrink: 0;
287
+ color: var(--fg-faint);
288
+ }
289
+
290
+ .model-check-dropdown[open] > summary svg {
291
+ transform: rotate(180deg);
292
+ }
293
+
294
+ .model-check-dropdown[open] > .model-checks {
295
+ margin-top: 6px;
296
+ }
297
+
269
298
  .model-checks {
270
299
  display: flex;
271
300
  flex-direction: column;
@@ -273,6 +302,8 @@
273
302
  border: 1px solid var(--border);
274
303
  border-radius: 10px;
275
304
  padding: 6px;
305
+ max-height: 280px;
306
+ overflow-y: auto;
276
307
  }
277
308
 
278
309
  .model-checks > small {
@@ -300,10 +331,12 @@
300
331
  }
301
332
 
302
333
  .model-check .t {
303
- white-space: nowrap;
334
+ min-width: 0;
335
+ overflow-wrap: anywhere;
304
336
  }
305
337
 
306
338
  .model-check .s {
339
+ min-width: 0;
307
340
  margin-left: auto;
308
341
  font-size: 12px;
309
342
  color: var(--fg-faint);
@@ -295,18 +295,12 @@ button.conv-group:hover {
295
295
  white-space: nowrap;
296
296
  }
297
297
 
298
- /* 放不下:尾巴淡出,代替省略号(.clip 由 sidebar.js 量过后加) */
298
+ /* 放不下:只在右侧淡出,悬停滚动时也保持左侧清晰(.clip 由 sidebar.js 量过后加) */
299
299
  .conv-item .title.clip {
300
300
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
301
301
  mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
302
302
  }
303
303
 
304
- /* 跑马灯滚动时两头都淡出 */
305
- .conv-item .title.clip.marquee {
306
- -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
307
- mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
308
- }
309
-
310
304
  .conv-item > .dot,
311
305
  .conv-item > .conv-spin {
312
306
  margin-left: auto;
@@ -383,7 +377,7 @@ button.conv-group:hover {
383
377
  width: 14px;
384
378
  height: 14px;
385
379
  margin-left: auto;
386
- color: var(--fg-soft);
380
+ color: var(--fg-faint);
387
381
  }
388
382
 
389
383
  .conv-item .task-mark svg {
@@ -414,8 +408,8 @@ button.conv-group:hover {
414
408
  display: inline-grid;
415
409
  }
416
410
 
417
- .conv-item:hover .expert-mark + .task-mark {
418
- margin-left: 0;
411
+ .conv-item:hover .task-mark {
412
+ display: none;
419
413
  }
420
414
  }
421
415
 
package/web/css/tasks.css CHANGED
@@ -24,10 +24,6 @@
24
24
  background: var(--bg-hover);
25
25
  }
26
26
 
27
- .conv-item .task-mark {
28
- color: var(--fg-soft);
29
- }
30
-
31
27
  /* 任务页不要输入框,也不要「回到底部」 */
32
28
  .main.tasks-view .composer-wrap,
33
29
  .main.tasks-view .to-bottom {
@@ -1,4 +1,4 @@
1
- import { fill, h, toast } from "../lib/dom.js";
1
+ import { fill, h, icon, toast } from "../lib/dom.js";
2
2
  import { api } from "../lib/api.js";
3
3
  import { copyText } from "../lib/markdown.js";
4
4
  import { desktopQuota, S } from "../state.js";
@@ -14,12 +14,32 @@ import { modelPicker } from "./commands.js";
14
14
  */
15
15
  function modelChecklist(agent, selected) {
16
16
  const box = h("div", { class: "model-checks" }, h("small", {}, "正在读取模型列表…"));
17
+ const summaryText = h("span", {}, "正在读取模型列表…");
18
+ const summary = h("summary", { class: "input model-check-summary" }, summaryText, icon("down"));
19
+ const dropdown = h("details", { class: "model-check-dropdown" }, summary, box);
17
20
  let boxes = null;
21
+ const syncSummary = () => {
22
+ const count = boxes.filter((b) => b.el.checked).length;
23
+ summaryText.textContent = count === boxes.length ? `全部模型(${count} 个)` : `已选 ${count} / ${boxes.length} 个模型`;
24
+ };
25
+ box.addEventListener("change", syncSummary);
26
+ dropdown.addEventListener("keydown", (e) => {
27
+ if (e.key === "Escape" && dropdown.open) {
28
+ e.preventDefault();
29
+ e.stopPropagation();
30
+ dropdown.open = false;
31
+ summary.focus();
32
+ }
33
+ });
18
34
  api(`/api/agents/${agent}/models`)
19
35
  .then((data) => {
20
36
  const models = data?.models ?? [];
21
- if (!models.length) return fill(box, h("small", {}, "没读到模型列表"));
37
+ if (!models.length) {
38
+ summaryText.textContent = "没读到模型列表";
39
+ return fill(box, h("small", {}, "没读到模型列表,保留原来的选择"));
40
+ }
22
41
  boxes = models.map((m) => ({ id: m.id, el: h("input", { type: "checkbox", checked: !selected.length || selected.includes(m.id) }) }));
42
+ syncSummary();
23
43
  fill(
24
44
  box,
25
45
  boxes.map(({ el }, i) => {
@@ -35,9 +55,12 @@ function modelChecklist(agent, selected) {
35
55
  h("small", {}, "只影响输入框里的模型选择列表;全部勾上 = 以后新出的模型也自动显示"),
36
56
  );
37
57
  })
38
- .catch((err) => fill(box, h("small", {}, err.status === 409 ? err.message : `读取模型列表失败:${err.message ?? err}`)));
58
+ .catch((err) => {
59
+ summaryText.textContent = "读取模型列表失败";
60
+ fill(box, h("small", {}, err.status === 409 ? err.message : `读取模型列表失败:${err.message ?? err}`));
61
+ });
39
62
  return {
40
- el: box,
63
+ el: dropdown,
41
64
  /** 列表没读到时原样保留;null = 一个都没勾 */
42
65
  value: () => {
43
66
  if (!boxes) return selected;
@@ -152,7 +175,7 @@ export function agentsTab(cfg, page) {
152
175
  // 自动生成会话名称:一行,勾上才显示后面的模型选择
153
176
  const titleOn = h("input", { type: "checkbox", checked: !!a.codex.autoTitle });
154
177
  const titlePick = modelPicker("codex", a.codex.titleModel ?? "", "", "跟随 config.toml");
155
- const titleModelEl = h("div", { class: "grow" }, titlePick.modelEl);
178
+ const titleModelEl = h("div", { class: "grow field" }, titlePick.modelEl);
156
179
  const syncTitle = () => (titleModelEl.hidden = !titleOn.checked);
157
180
  titleOn.addEventListener("change", syncTitle);
158
181
  syncTitle();
@@ -3,7 +3,8 @@ import { api } from "../lib/api.js";
3
3
  import { confirmDialog, modal, showMenu } from "../lib/overlay.js";
4
4
  import { S } from "../state.js";
5
5
  import { expertIcon, reloadExperts } from "../views/experts.js";
6
- import { agentCatalog } from "../views/topbar.js";
6
+ import { agentCatalog, baseName } from "../views/topbar.js";
7
+ import { changeCwd } from "../views/conv-actions.js";
7
8
 
8
9
  // ---------- 专家(设置里的一页) ----------
9
10
  // 专家 = 一份配置:引擎、提示词、权限、技能、MCP、子智能体。新建对话、定时任务时选,对话中途不能换。
@@ -153,7 +154,21 @@ function openEditor(data, e, reload, preset) {
153
154
  h("option", { value: "claude_code", selected: src.basePrompt === "claude_code" }, "追加在 Claude Code 原装提示词后面(写代码、干活更稳,每轮多约 1.6 万 token)"),
154
155
  );
155
156
  const perms = permChecks(src);
156
- const cwd = h("input", { value: src.cwd ?? "", placeholder: `留空就是工作区根目录(${S.workspaceRoot ?? ""})`, spellcheck: "false" });
157
+ let cwd = src.cwd ?? "";
158
+ const cwdBtn = h("button", { type: "button", class: "btn task-cwd" });
159
+ const showCwd = () => {
160
+ cwdBtn.textContent = cwd ? baseName(cwd) : `${baseName(S.workspaceRoot) || "工作区"}(工作区根目录)`;
161
+ cwdBtn.title = cwd || S.workspaceRoot || "";
162
+ };
163
+ showCwd();
164
+ cwdBtn.onclick = () =>
165
+ changeCwd({
166
+ current: cwd || S.workspaceRoot || "",
167
+ onPick: (p) => {
168
+ cwd = p === S.workspaceRoot ? "" : p;
169
+ showCwd();
170
+ },
171
+ });
157
172
  const memory = h("input", { type: "checkbox", checked: src.memory !== false });
158
173
  const welcome = h("input", { value: src.welcome ?? "", maxlength: "500", placeholder: "新对话页上的那句话,比如:想了解哪只股票?" });
159
174
  const quick = h("textarea", { rows: 4, placeholder: "一行一个,新对话页上点一下就填进输入框。可以写成「标题|提示词」,提示词里的 ___ 是要用户填的空" });
@@ -192,7 +207,7 @@ function openEditor(data, e, reload, preset) {
192
207
  void models.load(eng);
193
208
  };
194
209
  const sync = () => (cwdField.hidden = perms.access() === "web");
195
- const cwdField = field("默认工作目录", cwd, "新建对话、定时任务时默认在这个目录里(可以再改)。相对路径按工作区根目录算");
210
+ const cwdField = field("默认工作目录", cwdBtn, "新建对话、定时任务时默认在这个目录里(可以再改)。点击选择目录,默认使用工作区根目录");
196
211
  const baseField = field("基础提示词", basePrompt);
197
212
  const subField = field("子智能体", subBox, "主专家可以把子任务派给它们(Agent 工具)。子智能体的权限不能超过主专家,只支持 Claude 专家");
198
213
  engine.onchange = renderEngineParts;
@@ -239,7 +254,7 @@ function openEditor(data, e, reload, preset) {
239
254
  prompt: prompt.value,
240
255
  basePrompt: basePrompt.value,
241
256
  access: perms.access(),
242
- cwd: cwd.value,
257
+ cwd,
243
258
  webSearch: perms.checked("webSearch"),
244
259
  webFetch: perms.checked("webFetch"),
245
260
  skills: skills.value(),
@@ -32,7 +32,7 @@ export async function conversationTab(cfg, page) {
32
32
  allowBox,
33
33
  );
34
34
  const allowlist = await api("/api/claude/allowlist");
35
- const allowText = h("textarea", { rows: 8 });
35
+ const allowText = h("textarea", { class: "input", rows: 8 });
36
36
  allowText.value = allowlist.join("\n");
37
37
  fill(
38
38
  allowBox,
@@ -75,7 +75,7 @@ export async function memoryTab(panel) {
75
75
  toast("已保存,之后的对话会用上");
76
76
  });
77
77
 
78
- const newItem = h("input", { maxlength: mem.limits.item, style: { flex: "1", minWidth: "0" }, placeholder: "手动加一条,比如:我的软路由是 iStoreOS,地址 192.168.8.2" });
78
+ const newItem = h("input", { class: "input", maxlength: mem.limits.item, style: { flex: "1", minWidth: "0" }, placeholder: "手动加一条,比如:我的软路由是 iStoreOS,地址 192.168.8.2" });
79
79
  const addBtn = h("button", { class: "btn" }, "添加");
80
80
  addBtn.onclick = run(addBtn, async () => {
81
81
  if (!newItem.value.trim()) return false;
@@ -92,7 +92,7 @@ export async function memoryTab(panel) {
92
92
  const edit = h("button", { class: "btn small" }, "编辑");
93
93
  const del = h("button", { class: "btn small danger" }, "删除");
94
94
  edit.onclick = () => {
95
- const input = h("textarea", { rows: 2, maxlength: mem.limits.item });
95
+ const input = h("textarea", { class: "input", rows: 2, maxlength: mem.limits.item });
96
96
  input.value = it.text;
97
97
  const ok = h("button", { class: "btn small primary" }, "保存");
98
98
  ok.onclick = run(ok, () => api(`/api/account/memory/items/${it.id}`, { method: "PATCH", body: { text: input.value } }));
@@ -134,7 +134,7 @@ function embeddersSection(cfg) {
134
134
  const box = h("div", { class: "section", "data-form": "" });
135
135
  let list = [...cfg.servers.embedders];
136
136
  const rows = h("div", {});
137
- const input = h("input", { placeholder: "https://loft.example.com", autocapitalize: "off", spellcheck: "false" });
137
+ const input = h("input", { class: "input grow", placeholder: "https://loft.example.com", autocapitalize: "off", spellcheck: "false" });
138
138
 
139
139
  const render = () => {
140
140
  fill(