agent-loft 0.2.132 → 0.2.134

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 (55) hide show
  1. package/README.md +32 -29
  2. package/package.json +1 -1
  3. package/src/agents/dsh/errors.ts +2 -2
  4. package/src/agents/pi/constants.ts +1 -1
  5. package/src/agents/pi/errors.ts +2 -2
  6. package/src/agents/workbuddy/errors.ts +2 -2
  7. package/src/agents/workbuddy/sdk.ts +1 -1
  8. package/src/channels/feishu/bot.ts +3 -3
  9. package/src/channels/feishu/cards.ts +2 -2
  10. package/src/channels/web/desktop.ts +1 -1
  11. package/src/channels/web/memo-storage.ts +29 -2
  12. package/src/channels/web/memos-api.ts +34 -3
  13. package/src/channels/web/terminal.ts +1 -1
  14. package/src/channels/web/workspace-api.ts +2 -2
  15. package/src/channels/weixin/bot.ts +1 -1
  16. package/src/core/command-catalog.ts +1 -1
  17. package/src/core/commands.ts +1 -1
  18. package/src/core/feishu-links.ts +1 -1
  19. package/src/core/hub.ts +1 -1
  20. package/src/core/memo-index.ts +1 -1
  21. package/src/core/memo-versions.ts +4 -0
  22. package/src/core/memory-curator.ts +1 -1
  23. package/src/core/ui-prefs.ts +1 -1
  24. package/src/mcp/memory-server.ts +1 -1
  25. package/web/css/memos.css +138 -32
  26. package/web/css/mobile.css +8 -31
  27. package/web/css/settings.css +53 -32
  28. package/web/lib/dom.js +4 -0
  29. package/web/lib/markdown.js +4 -2
  30. package/web/lib/push.js +1 -1
  31. package/web/lib/shell.js +1 -1
  32. package/web/settings/agent-defaults.js +2 -16
  33. package/web/settings/agents.js +119 -95
  34. package/web/settings/commands.js +3 -4
  35. package/web/settings/experts.js +10 -9
  36. package/web/settings/feishu.js +3 -3
  37. package/web/settings/general.js +17 -14
  38. package/web/settings/index.js +177 -94
  39. package/web/settings/memory.js +50 -35
  40. package/web/settings/notify.js +1 -1
  41. package/web/settings/security.js +9 -3
  42. package/web/settings/servers.js +3 -3
  43. package/web/settings/skills.js +6 -4
  44. package/web/settings/tabs.js +61 -51
  45. package/web/settings/users.js +3 -7
  46. package/web/state.js +2 -2
  47. package/web/views/file-editor.js +16 -0
  48. package/web/views/layout.js +4 -4
  49. package/web/views/memo-dialogs.js +19 -1
  50. package/web/views/memo-find.js +124 -0
  51. package/web/views/memo-organize.js +40 -0
  52. package/web/views/memo-outline.js +84 -0
  53. package/web/views/memos.js +448 -86
  54. package/web/views/sidebar-nav.js +2 -1
  55. package/web/views/tasks.js +1 -1
@@ -124,7 +124,7 @@ export function helpText(agents: string[], channel?: string): string {
124
124
  ? "Agent 要授权或提问时会发一条消息,回复里面的数字作答;提问的选项都不合适就直接发文字。"
125
125
  : "Agent 给选项时会发一张提问卡,点按钮作答;都不合适就直接发消息,那条消息会被当成你的回答。",
126
126
  "",
127
- "**命令**(需整条消息只有命令;只发一个 `/` 可以列出命令;agent 自己的命令默认不在列表里,可以在设置 → 命令里勾选,没勾的照样可以直接发)",
127
+ "**命令**(需整条消息只有命令;只发一个 `/` 可以列出命令;agent 自己的命令默认不在列表里,可以在设置 → 快捷命令里勾选,没勾的照样可以直接发)",
128
128
  "",
129
129
  ...BUILTIN_COMMANDS.filter((c) => !c.multiAgentOnly || multi)
130
130
  .filter((c) => !c.feishuOnly || channel === "feishu")
@@ -100,7 +100,7 @@ export function redeemLinkCode(code: string, botId: string, openId: string): Use
100
100
  sweep();
101
101
  const key = code.trim().toUpperCase();
102
102
  const entry = codes.get(key);
103
- if (!entry) throw new Error("绑定码不对或已过期。请在 Web 上(设置 → 账号)重新生成一个。");
103
+ if (!entry) throw new Error("绑定码不对或已过期。请在 Web 上(设置 → 账号绑定)重新生成一个。");
104
104
  const user = getUser(entry.userId);
105
105
  if (!user || user.disabled) {
106
106
  codes.delete(key);
package/src/core/hub.ts CHANGED
@@ -1797,7 +1797,7 @@ class Hub extends EventEmitter<{
1797
1797
  "- `/permission edit`:自动改文件",
1798
1798
  ...(engineSupports(conv.agent, "auto") ? ["- `/permission auto`:自动判断(Claude 逐个判断安不安全,拿不准再问你)"] : []),
1799
1799
  "- `/permission full`:完全允许",
1800
- "- `/permission default`:恢复默认(设置 → 专家 → 内置 Agent 的「设置」里定的默认权限)",
1800
+ "- `/permission default`:恢复默认(助手中心 → 专家 → 内置 Agent 的「设置」里定的默认权限)",
1801
1801
  "- `/planmode on` / `/planmode off`:开关计划模式(先出方案,你批准了再动手)",
1802
1802
  "",
1803
1803
  `这条对话最高能到「${PERMISSION_LABEL[this.permissionMax(conv)]}」。`,
@@ -56,7 +56,7 @@ async function* listTextFiles(storage: MemoStorage, current: () => boolean) {
56
56
  const page = await storage.list(folder, cursor);
57
57
  for (const entry of page.entries) {
58
58
  const path = folder ? folder + "/" + entry.name : entry.name;
59
- if (!validMemoPath(path)) continue;
59
+ if (path === ".agent-loft-trash" || !validMemoPath(path)) continue;
60
60
  if (entry.directory) folders.add(path);
61
61
  else if (editable(path)) yield { path, etag: entry.etag };
62
62
  }
@@ -24,3 +24,7 @@ export function memoVersionText(owner: string, source: string, path: string, id:
24
24
  const row = sql(`SELECT content FROM memo_versions WHERE ${scope} AND id = ?`).get(owner, source, path, id);
25
25
  return row ? gunzipSync(row.content as Uint8Array).toString("utf8") : null;
26
26
  }
27
+
28
+ export function moveMemoVersions(owner: string, source: string, from: string, to: string) {
29
+ sql("UPDATE memo_versions SET path = ? WHERE " + scope).run(to, owner, source, from);
30
+ }
@@ -518,7 +518,7 @@ export function describeResult(r: CurateResult): string | undefined {
518
518
  ...r.updated.map((t) => `更新为「${clip(t)}」`),
519
519
  ...(r.removed.length ? [`移走了 ${r.removed.length} 条过时的`] : []),
520
520
  ];
521
- return parts.length ? `🧠 记忆已更新:${parts.join(";")}。(设置 → 记忆 里可以查看、修改和撤销)` : undefined;
521
+ return parts.length ? `🧠 记忆已更新:${parts.join(";")}。(助手中心 → 记忆 里可以查看、修改和撤销)` : undefined;
522
522
  }
523
523
 
524
524
  /** 按用户的设置挑 agent。指定的那个用不了就是 undefined(不悄悄换成另一个,免得用到他没想用的额度) */
@@ -4,7 +4,7 @@ import path from "node:path";
4
4
  import { dataDir, readJson, writeJsonAtomic } from "../home.js";
5
5
 
6
6
  export type SidebarNavItem = { id: string; visible: boolean };
7
- const NAV_IDS = ["search", "tasks", "library", "memos", "remote", "settings"];
7
+ const NAV_IDS = ["search", "tasks", "library", "memos", "remote", "assistants", "settings"];
8
8
  type Prefs = { dirOrder?: string[]; sidebarNav?: SidebarNavItem[]; expertOrder?: string[] };
9
9
 
10
10
  const prefsPath = path.join(dataDir, "ui-prefs.json");
@@ -275,7 +275,7 @@ function guard(id: string, args: Record<string, unknown>): string | undefined {
275
275
  const all = [...readMemory(userId).items, ...listMemoryItems(userId, "archive")];
276
276
  const item = all.find((i) => i.id === id);
277
277
  if (item && isProtected(item) && args.user_requested !== true) {
278
- return `这条是用户自己加的或者明确要求记的,受保护(${item.text})。只有用户在当前对话里明确要求时才能改,那样要带 user_requested: true;否则告诉用户可以到设置 → 记忆里改。`;
278
+ return `这条是用户自己加的或者明确要求记的,受保护(${item.text})。只有用户在当前对话里明确要求时才能改,那样要带 user_requested: true;否则告诉用户可以到助手中心 → 记忆里改。`;
279
279
  }
280
280
  return undefined;
281
281
  }
package/web/css/memos.css CHANGED
@@ -1,37 +1,114 @@
1
- .main .messages-inner:has(> .memo-page) { max-width: none; height: 100%; padding-inline: 12px; padding-bottom: 12px; }
2
- .memo-page { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(170px, 23%, 280px) minmax(0,1fr); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); }
1
+ .main:has(.memo-page) > .topbar { position: sticky; padding-bottom: 8px; background: var(--bg); }
2
+ .main:has(.memo-page) > .topbar::before, .main:has(.memo-page) > .topbar::after { display: none; }
3
+ .main .messages-inner:has(> .memo-page) { max-width: none; height: 100%; padding: 0; }
4
+ .memo-page {
5
+ --memo-accent: #7154ab;
6
+ --memo-tint: color-mix(in srgb, var(--memo-accent) 12%, var(--bg-side));
7
+ --memo-side-bg: color-mix(in srgb, var(--memo-accent) 4%, var(--bg-side));
8
+ --memo-measure: 680px;
9
+ --memo-gutter: clamp(18px, 5%, 64px);
10
+ --memo-page-top: clamp(26px, 5vh, 60px);
11
+ flex: 1;
12
+ min-height: 0;
13
+ display: grid;
14
+ position: relative;
15
+ isolation: isolate;
16
+ grid-template-columns: var(--memo-tree-width, 248px) minmax(0, 1fr);
17
+ overflow: hidden;
18
+ border-top: 1px solid var(--border);
19
+ }
20
+ @media (prefers-color-scheme: dark) {
21
+ .memo-page { --memo-accent: #b59ae8; }
22
+ }
3
23
  .memo-page.no-source { grid-template-columns: 1fr; }
4
24
  .memo-side, .memo-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
5
- .memo-side { background: var(--bg-side); border-right: 1px solid var(--border); }
6
- .memo-sources, .memo-tree-tools, .memo-bar, .memo-blankbar { display: flex; align-items: center; gap: 6px; padding: 8px; }
7
- .memo-sources { flex-wrap: wrap; }
8
- .memo-sources .input { width: 100%; min-width: 0; }
9
- .memo-side .icon-btn { width: 30px; height: 30px; flex-shrink: 0; }
10
- .memo-tree { overflow: auto; flex: 1; padding: 0 6px 12px; }
11
- .memo-tree .memo-branch { margin-left: 10px; padding-left: 3px; border-left: 1px solid var(--border); }
12
- .memo-tree small { color: var(--fg-soft); padding: 4px 8px; }
13
- .memo-row { display: flex; align-items: center; gap: 6px; text-align: left; padding: 5px 7px; width: 100%; border-radius: 6px; line-height: 1.45; }
14
- .memo-row span, .memo-path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
15
- .memo-row svg, .memo-empty > svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--fg-soft); }
25
+ .memo-side { position: relative; background: var(--memo-side-bg); border-right: 1px solid var(--border); }
26
+ .memo-scrim { display: none; }
27
+ .memo-divider { position: absolute; inset: 0 -5px 0 auto; width: 9px; z-index: 2; cursor: col-resize; touch-action: none; }
28
+ .memo-divider::after { content: ""; position: absolute; inset: 0 3px; }
29
+ .memo-divider:hover::after, .memo-divider:focus-visible::after, .resizing .memo-divider::after { background: var(--memo-accent); }
30
+ .memo-page.resizing { user-select: none; cursor: col-resize; }
31
+ .memo-tree-tools, .memo-bar, .memo-sources, .memo-footer { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
32
+ .memo-tree-tools, .memo-bar { min-height: 46px; padding: 5px 12px; border-bottom: 1px solid var(--border); }
33
+ .memo-tree-tools strong { flex: 1; font-size: 13px; font-weight: 600; }
34
+ .memo-page .icon-btn { width: 29px; height: 29px; flex-shrink: 0; border-radius: 5px; }
35
+ .memo-panel-button svg { transform: scaleX(-1); }
36
+ .memo-page .icon-btn svg, .memo-page .btn svg, .memo-settings svg, .memo-bar svg { width: 16px; height: 16px; }
37
+ .memo-tree { flex: 1; overflow: auto; padding: 10px 8px; }
38
+ .memo-tree .memo-branch { margin-left: 12px; padding-left: 4px; border-left: 1px solid var(--border); }
39
+ .memo-branch > small { color: var(--fg-soft); padding: 4px 9px; font-size: 12px; }
40
+ .memo-row { position: relative; display: flex; align-items: center; gap: 7px; text-align: left; width: 100%; min-height: 32px; padding: 4px 9px; border-radius: 5px; font-size: 13px; line-height: 1.45; color: var(--fg-soft); }
41
+ .memo-extension { color: var(--fg-soft); font-size: .86em; font-weight: 400; }
42
+ .memo-row span:last-child, .memo-path, .memo-breadcrumb > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
43
+ .memo-row svg { width: 15px; height: 15px; }
44
+ .memo-row > span:first-of-type { flex-shrink: 0; }
16
45
  .memo-row:hover { background: var(--bg-hover); }
17
- .memo-row.selected { background: var(--bg-hover); font-weight: 600; }
18
- .memo-row[aria-expanded]::before { content: "›"; width: 8px; color: var(--fg-soft); }
19
- .memo-row[aria-expanded=true]::before { transform: rotate(90deg); }
20
- .memo-bar { min-height: 48px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
21
- .memo-path { flex: 1; min-width: 60px; font-size: 14px; }
22
- .memo-status { color: var(--fg-soft); font-size: 12px; }
46
+ .memo-row.current-dir, .memo-root { color: var(--fg); font-weight: 600; }
47
+ .memo-row.selected { background: var(--memo-tint); color: var(--memo-accent); font-weight: 600; }
48
+ .memo-row[aria-current="page"]::before { content: ""; position: absolute; left: 0; inset-block: 7px; width: 3px; border-radius: 3px; background: var(--memo-accent); }
49
+ .memo-row[aria-busy="true"]::after { content: ""; flex: none; margin-left: auto; width: 9px; height: 9px; border: 1.5px solid var(--border); border-top-color: var(--memo-accent); border-radius: 50%; }
50
+ @media (prefers-reduced-motion: no-preference) {
51
+ .memo-row[aria-busy="true"]::after { animation: memo-loading .75s linear infinite; }
52
+ @keyframes memo-loading { to { transform: rotate(1turn); } }
53
+ }
54
+ .memo-row[aria-expanded]::before { content: ""; width: 5px; height: 5px; flex: none; border: solid currentColor; border-width: 1px 1px 0 0; transform: rotate(45deg); }
55
+ .memo-row[aria-expanded=true]::before { transform: rotate(135deg); }
56
+ .memo-sources { border-top: 1px solid var(--border); padding: 9px 10px; }
57
+ .memo-sources > span { padding: 6px; border-radius: 6px; background: var(--memo-tint); color: var(--memo-accent); }
58
+ .memo-sources svg { width: 16px; height: 16px; }
59
+ .memo-sources select.input { flex: 1; min-width: 0; height: 30px; line-height: normal; border: 0; border-radius: 4px; font-size: 13px; font-weight: 600; background-color: transparent; padding: 0 21px 0 5px; background-position: right 4px center; }
60
+ .memo-sources select.input:hover { background-color: var(--bg-hover); }
61
+ .memo-page :is(button, select):focus-visible { outline: 2px solid var(--memo-accent); outline-offset: -2px; }
62
+ .memo-settings button { display: flex; align-items: center; gap: 9px; }
63
+ .memo-outline { width: min(288px, calc(100vw - 16px)); }
64
+ .memo-outline nav button { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
65
+ .memo-outline button[aria-current="location"] { background: var(--ask-bg); color: var(--fg); font-weight: 600; }
66
+ .memo-paper :is(h1,h2,h3,h4,h5,h6):focus-visible { outline: 2px solid var(--memo-accent); outline-offset: 3px; border-radius: 2px; }
67
+ .memo-bar { color: var(--fg-soft); font-size: 13px; padding-inline: 16px; gap: 8px; }
68
+ .memo-modes { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 8px; background: var(--bg-soft); }
69
+ .memo-modes button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 26px; padding: 3px 9px; border-radius: 5px; font-size: 12px; color: var(--fg-soft); }
70
+ .memo-modes button:hover { background: var(--bg-hover); }
71
+ .memo-modes button[aria-pressed="true"] { color: var(--memo-accent); font-weight: 600; background: var(--bg); box-shadow: 0 1px 3px #0002; }
72
+ .memo-breadcrumb { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 8px; }
73
+ .memo-breadcrumb > span:first-child { flex: 0 2 auto; }
74
+ .memo-breadcrumb strong { color: var(--fg); font-weight: 550; }
75
+ .memo-footer .btn { min-height: 28px; padding: 3px 8px; border-radius: 5px; font-size: 12px; }
76
+ .memo-footer { min-height: 27px; padding: 2px 12px; justify-content: flex-end; border-top: 1px solid var(--border); }
77
+ .memo-status { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-soft); font-size: 12px; }
78
+ .memo-status:not(:empty)::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint); }
79
+ .memo-status[data-state="saved"]::before { background: var(--ok); }
80
+ .memo-status[data-state="pending"]::before { background: var(--memo-accent); }
81
+ .memo-status[data-state="error"] { color: var(--danger); font-weight: 600; }
82
+ .memo-status[data-state="error"]::before { background: currentColor; }
23
83
  .memo-editor, .memo-reading { flex: 1; min-height: 0; overflow: auto; }
24
84
  .memo-editor .cm-editor { height: 100%; background: var(--bg); }
25
- .memo-editor .cm-content { padding: 14px 8px 40px; }
85
+ .memo-editor .cm-content { padding: 18px 8px 40px; }
26
86
  .memo-editor .cm-scroller { font-family: var(--mono); }
27
- .memo-reading { padding: 18px clamp(14px, 4%, 56px); overflow-wrap: anywhere; }
28
- .memo-reading .md { max-width: 85ch; margin-inline: auto; }
87
+ .memo-reading { padding: var(--memo-page-top) var(--memo-gutter) 64px; overflow-wrap: anywhere; }
88
+ .memo-paper, .memo-reading > pre { max-width: var(--memo-measure); margin: 0 auto; }
89
+ .memo-paper, .memo-prose .cm-scroller { font: 16px/1.8 var(--font); }
90
+ .memo-prose .cm-content { padding: var(--memo-page-top) max(var(--memo-gutter), calc((100% - var(--memo-measure)) / 2)) 64px; caret-color: var(--memo-accent); }
91
+ .memo-prose .cm-gutters { display: none; }
92
+ .memo-prose .cm-line { padding: 0; }
93
+ .memo-prose .cm-editor .cm-activeLine { background: transparent; }
94
+ .memo-prose .cm-editor.cm-focused { outline: none; }
95
+ .memo-note-title, .memo-paper .md > h1:first-child { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.25; letter-spacing: -.03em; margin: 0 0 .85em; padding-bottom: .55em; border-bottom: 1px solid var(--border); }
96
+ .memo-paper .md :is(h2, h3):not(:first-child) { margin-top: 1.55em; }
97
+ .memo-paper .md blockquote { margin: 1em 0; padding: .55em 1em; border-left-color: var(--memo-accent); border-radius: 0 5px 5px 0; background: color-mix(in srgb, var(--memo-accent) 6%, var(--bg)); }
98
+ .memo-paper .md blockquote > :first-child { margin-top: 0; }
99
+ .memo-paper .md blockquote > :last-child { margin-bottom: 0; }
100
+ .memo-paper .md li::marker { color: var(--memo-accent); }
101
+ .memo-paper .md a { color: var(--memo-accent); }
29
102
  .memo-reading pre { white-space: pre-wrap; }
30
103
  .memo-reading img { max-width: 100%; height: auto; }
31
- .memo-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 18px; text-align: center; }
32
- .memo-empty > svg { width: 32px; height: 32px; }
33
- .memo-empty h2, .memo-empty p { margin: 0; }
34
- .memo-empty p { color: var(--fg-soft); }
104
+ .memo-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; }
105
+ .memo-empty > span { background: var(--memo-tint); color: var(--memo-accent); padding: 12px; border-radius: 12px; }
106
+ .memo-empty svg { width: 24px; height: 24px; }
107
+ .memo-empty h2 { font-size: 19px; font-weight: 600; margin: 6px 0 0; }
108
+ .memo-empty p { font-size: 13px; margin: 0; color: var(--fg-soft); }
109
+ .memo-empty .btn { margin-top: 8px; }
110
+ .memo-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
111
+ .memo-fields p { margin: 0; }
35
112
  .memo-fields, .memo-fields label { display: flex; flex-direction: column; gap: 5px; }
36
113
  .memo-fields { gap: 12px; }
37
114
  .memo-fields label { font-size: 13px; }
@@ -39,14 +116,43 @@
39
116
  .memo-fields .memo-expert-access { display: grid; grid-template-columns: minmax(0, 1fr) minmax(8em, 40%); align-items: center; overflow-wrap: anywhere; }
40
117
  .memo-fields .btn { align-self: flex-end; }
41
118
  .memo-error { color: var(--danger); }
42
- .memo-page [hidden], .memo-fields[hidden], .memo-blankbar, .memo-bar > button:first-child, .memo-return { display: none; }
119
+ .memo-page [hidden], .memo-fields[hidden], .memo-page .memo-mobile, .memo-page .memo-return { display: none; }
120
+ @media (min-width: 769px) {
121
+ .memo-page.has-file.tree-collapsed { grid-template-columns: minmax(0, 1fr); }
122
+ .memo-page.has-file.tree-collapsed .memo-side { display: none; }
123
+ }
43
124
  @media (max-width: 768px) {
44
- .main .messages-inner:has(> .memo-page) { padding-inline: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
45
- .memo-page { display: flex; flex-direction: column; }
125
+ .memo-page { display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
46
126
  .memo-side, .memo-pane { flex: 1; }
47
- .memo-side { display: none; border-right: none; }
48
- .memo-page.show-tree .memo-side:not([hidden]), .memo-blankbar, .memo-bar > button:first-child, .memo-page.has-file .memo-return { display: flex; }
49
- .memo-page.show-tree:not(.no-source) .memo-pane { display: none; }
127
+ .memo-side, .memo-divider, .memo-page .memo-desktop { display: none; }
128
+ .memo-side { border-right: none; }
129
+ .memo-page.show-tree .memo-side:not([hidden]) { display: flex; }
130
+ .memo-page .memo-mobile, .memo-page.has-file .memo-return { display: inline-grid; }
131
+ .memo-page.show-tree:not(.no-source):not(.has-file) .memo-pane { display: none; }
132
+ .memo-page.has-file.show-tree .memo-side { position: absolute; inset: 0 auto 0 0; z-index: 4; width: min(82%, 320px); box-shadow: 6px 0 22px #0002; padding-bottom: env(safe-area-inset-bottom); }
133
+ .memo-page.has-file.show-tree .memo-scrim { display: block; position: absolute; inset: 0; z-index: 3; background: #19162252; cursor: default; }
134
+ @media (prefers-reduced-motion: no-preference) {
135
+ .memo-page.has-file.show-tree .memo-side { animation: memo-drawer-in 150ms ease-out; }
136
+ @keyframes memo-drawer-in { from { transform: translateX(-100%); } }
137
+ }
138
+ .memo-page .icon-btn { width: 44px; height: 44px; }
139
+ .memo-tree-tools { padding: 2px 6px; }
140
+ .memo-row { min-height: 42px; font-size: 14px; }
141
+ .memo-bar { gap: 4px; padding-inline: 6px; }
142
+ .memo-breadcrumb > span { display: none; }
143
+ .memo-modes button { gap: 0; min-width: 42px; min-height: 38px; padding: 4px; }
144
+ .memo-modes button svg { display: none; }
50
145
  .memo-fields input, .memo-editor { font-size: 16px; }
51
146
  }
52
147
  .memo-snapshot { min-height: 5rem; max-height: 45vh; overflow: auto; margin: 0; padding: 12px; background: var(--bg-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
148
+ .memo-find-tools { display: flex; align-items: center; gap: 8px; }
149
+ .memo-find-tools .btn { white-space: nowrap; }
150
+ .memo-find-tools [aria-pressed=true], .memo-result .icon-btn[aria-pressed=true] { color: var(--link); background: var(--ask-bg); }
151
+ .memo-results, .memo-refs { max-height: 45vh; overflow: auto; }
152
+ .memo-result { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 6px; }
153
+ .memo-result.active, .memo-result:hover { background: var(--bg-soft); }
154
+ .memo-found { flex: 1; min-width: 0; display: grid; text-align: start; padding: 4px 8px; overflow-wrap: anywhere; }
155
+ .memo-found small { color: var(--fg-soft); }
156
+ .memo-paper input[type=checkbox]:enabled { accent-color: var(--memo-accent); cursor: pointer; }
157
+
158
+ ::highlight(memo-search) { background: #fee184; color: #241c0b; }
@@ -185,37 +185,14 @@
185
185
  padding-bottom: env(safe-area-inset-bottom);
186
186
  }
187
187
 
188
- .settings {
189
- flex-direction: column;
190
- }
191
-
192
- .settings-nav {
193
- width: auto;
194
- flex-direction: row;
195
- overflow-x: auto;
196
- border-right: none;
197
- border-bottom: 1px solid var(--border);
198
- }
199
-
200
- .settings-nav button {
201
- white-space: nowrap;
202
- flex-shrink: 0;
203
- }
204
-
205
- /* 横排时分组标题换成一道竖线 */
206
- .settings-group {
207
- flex-shrink: 0;
208
- width: 1px;
209
- margin: 6px 4px;
210
- padding: 0;
211
- font-size: 0;
212
- background: var(--border);
213
- }
214
-
215
- .settings-group:first-child {
216
- display: none;
217
- }
218
-
188
+ .settings { flex-direction: column; }
189
+ .settings-nav { display: none; flex: 1; border: 0; padding: 12px 16px; }
190
+ .settings-view.at-directory .settings-nav { display: block; }
191
+ .settings-view.at-directory .settings-body { display: none; }
192
+ .settings-view:not(.at-directory) .settings-directory-back { display: inline-flex; }
193
+ .settings-header .icon-btn, .settings-directory-back { min-height: 44px; min-width: 44px; }
194
+ .settings-nav-link { min-height: 44px; padding-inline: 12px; }
195
+ .settings-search input[type="search"] { min-height: 44px; font-size: 16px; }
219
196
  .settings-body {
220
197
  padding: 12px;
221
198
  }
@@ -68,48 +68,69 @@ body:has(.settings) > :is(.overlay, .menu) {
68
68
  }
69
69
 
70
70
  .settings-nav {
71
- width: 160px;
72
- border-right: 1px solid var(--border);
73
- padding: 8px;
74
- display: flex;
75
- flex-direction: column;
76
- gap: 2px;
77
- flex-shrink: 0;
71
+ flex: 0 0 clamp(178px, 19%, 246px);
72
+ min-width: 0;
73
+ border-inline-end: 1px solid var(--border);
74
+ padding: 14px 10px;
78
75
  overflow-y: auto;
76
+ overscroll-behavior: contain;
79
77
  }
80
78
 
81
- /* 导航里的分组标题:我的 / Agent / 连接 / 管理 */
82
- .settings-group {
83
- padding: 12px 10px 4px;
84
- font-size: 12px;
85
- color: var(--fg-faint);
86
- }
87
-
88
- .settings-group:first-child {
89
- padding-top: 4px;
90
- }
91
-
92
- .settings-nav button {
93
- text-align: left;
94
- padding: 7px 10px;
95
- border-radius: 8px;
96
- font-size: 14px;
79
+ .settings-search {
80
+ display: flex;
81
+ align-items: center;
82
+ gap: 8px;
83
+ border: 1px solid var(--border);
84
+ border-radius: 9px;
85
+ padding-inline: 10px;
86
+ color: var(--fg-soft);
97
87
  }
98
88
 
99
- .settings-nav button:hover {
100
- background: var(--bg-hover);
89
+ .settings-search input[type="search"] {
90
+ flex: 1;
91
+ width: 0;
92
+ min-width: 0;
93
+ border: 0;
94
+ background: transparent;
95
+ color: var(--fg);
96
+ padding: 9px 0;
101
97
  }
102
98
 
103
- .settings-nav button.on {
104
- background: var(--bg-hover);
99
+ .settings-search:focus-within { outline: 2px solid var(--fg-soft); }
100
+ .settings-search input:focus-visible { outline: 0; }
101
+ .settings-links { display: grid; gap: 2px; margin-top: 10px; }
102
+ .settings-group {
103
+ margin: 12px 9px 4px;
104
+ font-size: 12px;
105
105
  font-weight: 600;
106
+ color: var(--fg-soft);
106
107
  }
107
-
108
- .settings-body {
109
- flex: 1;
108
+ .settings-nav-link {
109
+ display: flex;
110
+ align-items: center;
111
+ gap: 10px;
110
112
  min-width: 0;
111
- overflow-y: auto;
112
- padding: 16px;
113
+ text-align: start;
114
+ padding: 9px;
115
+ border-radius: 7px;
116
+ font-size: 14px;
117
+ }
118
+ .settings-nav-link small { display: block; color: var(--fg-soft); font-weight: normal; }
119
+ .settings-nav-link:hover, .settings-nav-link[aria-current="page"] { background: var(--bg-hover); }
120
+ .settings-nav-link[aria-current="page"] { font-weight: 650; box-shadow: inset 2px 0 var(--fg); }
121
+ .settings-nav-link svg, .settings-search svg { display: block; width: 17px; height: 17px; }
122
+ .settings-body { flex: 1; min-width: 0; overflow-y: auto; padding: 20px clamp(16px, 3vw, 40px); }
123
+ .settings-page .muted, .settings-page .field > small { color: var(--fg-soft); }
124
+ .engine-model-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
125
+ .engine-advanced summary { cursor: pointer; font-weight: 600; }
126
+ .engine-advanced > .field { margin-top: 12px; }
127
+ .settings-page-title { max-width: 1100px; margin: 0 auto 16px; font-size: 21px; line-height: 1.4; }
128
+ .settings-header .grow { flex: 1; }
129
+ .settings-directory-back { display: none; }
130
+ .settings-sr { position: absolute; inline-size: 1px; block-size: 1px; clip-path: inset(50%); overflow: hidden; }
131
+ .settings-header button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
132
+ @media (forced-colors: active) {
133
+ .settings-nav-link[aria-current="page"] { outline: 2px solid Highlight; }
113
134
  }
114
135
 
115
136
  /* 一页的内容,和一组一起保存的几节(Agent 页的 Claude Code + Codex) */
package/web/lib/dom.js CHANGED
@@ -55,6 +55,10 @@ export const ICON = {
55
55
  library: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="14" height="14" rx="2"/><path d="M7 3h12a2 2 0 0 1 2 2v12"/><path d="m3 17 4-4 3 3 2-2 5 5"/></svg>',
56
56
  check: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="m5 12.5 4.5 4.5L19 7.5"/></svg>',
57
57
  folder: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7.5A2.5 2.5 0 0 1 5.5 5h3.6l2 2.2h7.4A2.5 2.5 0 0 1 21 9.7v7.8a2.5 2.5 0 0 1-2.5 2.5h-13A2.5 2.5 0 0 1 3 17.5Z"/><path d="M3 10h18"/></svg>',
58
+ folderPlus: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"/><path d="M12 10v7m-3.5-3.5h7"/></svg>',
59
+ bookmark: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M6 4h12v17l-6-4-6 4z"/></svg>',
60
+ notebook: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="3" width="15" height="18" rx="2"/><path d="M9 3v18m3-13h5"/></svg>',
61
+ outline: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M4 6h3m4 0h9M7 12h3m4 0h6M4 18h3m4 0h9"/></svg>',
58
62
  folderOpen: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M3 17.5V7.5A2.5 2.5 0 0 1 5.5 5h3.6l2 2.2h6.4A2.5 2.5 0 0 1 20 9.7V11"/><path d="M3 17.5 5.6 12a2 2 0 0 1 1.8-1.1h13a1 1 0 0 1 .9 1.4l-2.4 6.2a2.2 2.2 0 0 1-2 1.5H5.5A2.5 2.5 0 0 1 3 17.5Z"/></svg>',
59
63
  file: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z"/><path d="M14 3v5h5"/></svg>',
60
64
  panel: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M15 4v16"/></svg>',
@@ -47,6 +47,7 @@ export function patchMarkdown(div, text, { live = false, enhance, prepare, sanit
47
47
  n.remove();
48
48
  }
49
49
  }
50
+ let offset = blocks.at(-1)?.end ?? 0;
50
51
  for (; i <= last; i++) {
51
52
  const final = !(live && i === last);
52
53
  const chunk = chunks[i];
@@ -58,14 +59,15 @@ export function patchMarkdown(div, text, { live = false, enhance, prepare, sanit
58
59
  // Resolve vault links while the document is inert, before the browser fetches images.
59
60
  const template = document.createElement("template");
60
61
  template.innerHTML = html;
61
- prepare(template.content);
62
+ prepare(template.content, { raw: raws[i], offset, chunk });
62
63
  box.append(template.content);
63
64
  } else box.innerHTML = html;
64
65
  decorate(box, final);
65
66
  enhance?.(box, { final });
66
67
  const nodes = [...box.childNodes];
67
68
  div.append(...nodes);
68
- blocks.push({ raw: raws[i], final, nodes });
69
+ offset += raws[i].length;
70
+ blocks.push({ raw: raws[i], final, nodes, end: offset });
69
71
  }
70
72
  }
71
73
 
package/web/lib/push.js CHANGED
@@ -7,7 +7,7 @@ export function pushSupport() {
7
7
  const ios = /iPhone|iPad|iPod/.test(navigator.userAgent);
8
8
  const standalone = window.matchMedia("(display-mode: standalone)").matches || navigator.standalone === true;
9
9
  if (desktop) return { ok: false, why: "桌面端会直接弹出 macOS 系统通知,不需要在这里开启。" };
10
- if (framed) return { ok: false, framed: true, why: "这台是在别的服务器的页面里打开的:通知跟着外层那台走,在那边的 设置 → 通知 里开启,这台的提醒也会推过去。" };
10
+ if (framed) return { ok: false, framed: true, why: "这台是在别的服务器的页面里打开的:通知跟着外层那台走,在那边的 设置 → 设备通知 里开启,这台的提醒也会推过去。" };
11
11
  if (!window.isSecureContext) return { ok: false, why: "通知需要 HTTPS 访问(localhost 除外)。请通过 HTTPS 的反向代理地址打开。" };
12
12
  if (ios && !standalone) {
13
13
  return { ok: false, why: "iPhone / iPad 上要先在 Safari 里点「分享 → 添加到主屏幕」,再从桌面图标打开,才能开启通知(需 iOS 16.4+)。" };
package/web/lib/shell.js CHANGED
@@ -669,7 +669,7 @@ export async function handleAllowEmbed(confirmDialog, toast) {
669
669
  if (!embedders.includes(origin)) {
670
670
  const ok = await confirmDialog({
671
671
  title: "允许在别的服务器上切换到这台?",
672
- message: `${origin} 的页面左上角会多出这台,切过来时这台的页面嵌在那边显示(照样要登录这台的账号,聊天内容不经过那台)。以后不想要了,在 设置 → 服务器 里移除。`,
672
+ message: `${origin} 的页面左上角会多出这台,切过来时这台的页面嵌在那边显示(照样要登录这台的账号,聊天内容不经过那台)。以后不想要了,在 设置 → 多服务器 里移除。`,
673
673
  confirmText: "允许",
674
674
  });
675
675
  if (!ok) return;
@@ -5,8 +5,7 @@ import { modal, confirmDialog } from "../lib/overlay.js";
5
5
  import { isAdmin, S } from "../state.js";
6
6
  import { renderContext } from "../views/topbar.js";
7
7
  import { DEFAULT_LEVELS, engineSupports, PERMISSIONS } from "../lib/permission.js";
8
- import { field, hasDirty, markDirty, saveButton, saveConfig } from "./common.js";
9
- import { modelPicker } from "./commands.js";
8
+ import { field, hasDirty, markDirty, saveButton } from "./common.js";
10
9
 
11
10
  // ---------- 内置 Agent 的默认设置(设置 → 专家 → 内置卡片上的「设置」) ----------
12
11
  // 默认模型 / 思考程度:整台服务器的(config),只有管理员能改;
@@ -14,7 +13,6 @@ import { modelPicker } from "./commands.js";
14
13
 
15
14
  /** 设置里的默认权限「跟随」时实际是什么 */
16
15
  const FOLLOW_LABEL = { claude: "跟随 Claude Code(逐次询问)", codex: "跟随沙箱设置", workbuddy: "跟随 WorkBuddy(逐次询问)", dsh: "跟随 dsh(工作区可写,越界才问)", pi: "跟随 pi(逐次询问)" };
17
- const DEFAULT_MODEL_LABEL = { claude: "跟随 Claude Code 默认", codex: "跟随 config.toml", workbuddy: "跟随 WorkBuddy 默认", dsh: "跟随 dsh 默认", pi: "pi 自动挑一个能用的" };
18
16
 
19
17
  /** 技能 / MCP:「跟随」或者「指定加载」+ 勾选 */
20
18
  function loadPicker(label, items, selected, inheritLabel) {
@@ -68,9 +66,8 @@ export function openAgentDefaults(engine, label) {
68
66
 
69
67
  const load = async () => {
70
68
  let data;
71
- let cfg = null;
72
69
  try {
73
- [data, cfg] = await Promise.all([api("/api/agents/defaults"), isAdmin() ? api("/api/config") : null]);
70
+ data = await api("/api/agents/defaults");
74
71
  } catch (err) {
75
72
  fill(form, h("div", { class: "error-text" }, err.message), h("button", { class: "btn small", onclick: load }, "重试"));
76
73
  return;
@@ -80,8 +77,6 @@ export function openAgentDefaults(engine, label) {
80
77
  fill(form, h("p", { class: "muted" }, `没有 ${label} 的使用权限,请联系管理员。`));
81
78
  return;
82
79
  }
83
- const server = cfg?.agents?.[engine];
84
- const pick = server ? modelPicker(engine, server.defaultModel ?? "", server.defaultEffort ?? "", DEFAULT_MODEL_LABEL[engine] ?? "跟随默认") : null;
85
80
 
86
81
  const skills = loadPicker(`${label} 技能`, data.skills, prefs.skills, "全部已启用的个人技能(含以后新增)");
87
82
  const memos = expertMemoField(data.memoLibraries, engine);
@@ -99,13 +94,6 @@ export function openAgentDefaults(engine, label) {
99
94
 
100
95
  fill(
101
96
  form,
102
- pick
103
- ? [
104
- h("h4", {}, "默认模型"),
105
- h("p", { class: "skill-note" }, "整台服务器的默认值,对所有成员生效;对话里可以随时换。自定义专家自己选了模型的按专家的来。"),
106
- h("div", { class: "row-fields" }, field("模型", pick.modelEl), engine === "workbuddy" ? null : field("思考程度", pick.effortEl)),
107
- ]
108
- : null,
109
97
  h("h4", {}, "默认权限"),
110
98
  field(
111
99
  "新对话的权限",
@@ -128,8 +116,6 @@ export function openAgentDefaults(engine, label) {
128
116
  body: { agents: { [engine]: { permission: permission.value || null, skills: skills.value(), machineSkills: machineSkills.checked, mcp: mcp.value(), memoAccess: memos.changes() } } },
129
117
  });
130
118
  S.defaultPermission = { ...S.defaultPermission, [engine]: res.agents?.[engine]?.permission ?? null };
131
- const changed = pick && (pick.model() !== (server.defaultModel ?? "") || pick.effort() !== (server.defaultEffort ?? ""));
132
- if (changed && !(await saveConfig(cfg, { agents: { [engine]: { defaultModel: pick.model(), defaultEffort: pick.effort() } } }))) return false;
133
119
  renderContext();
134
120
  toast("已保存,下次发消息生效");
135
121
  close();