agent-loft 0.2.134 → 0.2.135
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/README.md +30 -30
- package/package.json +1 -1
- package/src/agents/dsh/errors.ts +2 -2
- package/src/agents/pi/constants.ts +1 -1
- package/src/agents/pi/errors.ts +2 -2
- package/src/agents/workbuddy/errors.ts +2 -2
- package/src/agents/workbuddy/sdk.ts +1 -1
- package/src/channels/feishu/bot.ts +3 -3
- package/src/channels/feishu/cards.ts +2 -2
- package/src/channels/web/api.ts +3 -1
- package/src/channels/web/desktop.ts +1 -1
- package/src/channels/web/terminal.ts +1 -1
- package/src/channels/web/workspace-api.ts +2 -2
- package/src/channels/weixin/bot.ts +1 -1
- package/src/core/command-catalog.ts +1 -1
- package/src/core/commands.ts +1 -1
- package/src/core/feishu-links.ts +1 -1
- package/src/core/hub.ts +3 -3
- package/src/core/memory-curator.ts +1 -1
- package/src/core/ui-prefs.ts +11 -5
- package/src/mcp/memory-server.ts +1 -1
- package/web/css/mobile.css +15 -4
- package/web/css/settings.css +14 -6
- package/web/lib/overlay.js +15 -2
- package/web/lib/push.js +1 -1
- package/web/lib/shell.js +1 -1
- package/web/settings/agent-defaults.js +1 -0
- package/web/settings/agents.js +8 -9
- package/web/settings/commands.js +29 -25
- package/web/settings/experts.js +9 -8
- package/web/settings/feishu.js +3 -3
- package/web/settings/general.js +6 -4
- package/web/settings/index.js +152 -154
- package/web/settings/memory-sync.js +1 -1
- package/web/settings/memory.js +14 -39
- package/web/settings/notify.js +1 -1
- package/web/settings/security.js +8 -6
- package/web/settings/servers.js +3 -2
- package/web/settings/skills.js +4 -1
- package/web/settings/tabs.js +37 -31
- package/web/settings/usage.js +3 -3
- package/web/settings/users.js +22 -1
- package/web/settings/weixin.js +1 -1
- package/web/views/layout.js +2 -2
- package/web/views/memo-dialogs.js +1 -1
- package/web/views/sidebar-gestures.js +1 -1
- package/web/views/sidebar-nav.js +1 -2
- package/web/views/tasks.js +1 -1
- package/web/views/topbar.js +1 -1
package/src/core/ui-prefs.ts
CHANGED
|
@@ -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", "
|
|
7
|
+
const NAV_IDS = ["search", "tasks", "library", "memos", "remote", "settings"];
|
|
8
8
|
type Prefs = { dirOrder?: string[]; sidebarNav?: SidebarNavItem[]; expertOrder?: string[] };
|
|
9
9
|
|
|
10
10
|
const prefsPath = path.join(dataDir, "ui-prefs.json");
|
|
@@ -56,16 +56,22 @@ export function appendDirOrder(userId: string, dirs: unknown): string[] {
|
|
|
56
56
|
return dirOrder;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
/**
|
|
59
|
+
/** 新菜单接在最后;未配置过的菜单沿用默认显示方式。 */
|
|
60
60
|
function cleanSidebarNav(value: unknown): SidebarNavItem[] {
|
|
61
61
|
const items: SidebarNavItem[] = [];
|
|
62
62
|
const seen = new Set<string>();
|
|
63
|
-
|
|
63
|
+
const saved = Array.isArray(value) ? value : [];
|
|
64
|
+
const oldHub = saved.find(it => it?.id === "assistants");
|
|
65
|
+
const oldSettings = saved.find(it => it?.id === "settings");
|
|
66
|
+
const useHub = oldHub && (!oldSettings || (oldSettings.visible === false && oldHub.visible !== false));
|
|
67
|
+
for (const entry of saved) {
|
|
68
|
+
if (useHub && entry?.id === "settings") continue;
|
|
69
|
+
const item = useHub && entry === oldHub ? { ...entry, id: "settings" } : entry;
|
|
64
70
|
if (!item || typeof item !== "object" || !NAV_IDS.includes(item.id) || seen.has(item.id)) continue;
|
|
65
71
|
seen.add(item.id);
|
|
66
|
-
items.push({ id: item.id, visible:
|
|
72
|
+
items.push({ id: item.id, visible: item.visible !== false });
|
|
67
73
|
}
|
|
68
|
-
for (const id of NAV_IDS) if (!seen.has(id)) items.push({ id, visible:
|
|
74
|
+
for (const id of NAV_IDS) if (!seen.has(id)) items.push({ id, visible: true });
|
|
69
75
|
return items;
|
|
70
76
|
}
|
|
71
77
|
|
package/src/mcp/memory-server.ts
CHANGED
|
@@ -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/mobile.css
CHANGED
|
@@ -185,12 +185,23 @@
|
|
|
185
185
|
padding-bottom: env(safe-area-inset-bottom);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
.settings-editor .modal { width: 100%; height: 100%; max-height: 100%; border-radius: 0; padding-top: env(safe-area-inset-top); }
|
|
189
|
+
.settings-editor .modal-body { min-height: 0; overflow-y: auto; }
|
|
188
190
|
.settings { flex-direction: column; }
|
|
191
|
+
.settings-header { padding-block: env(safe-area-inset-top) 0; border: 0; }
|
|
192
|
+
.settings-header .icon-btn { display: inline-flex; min-height: 44px; min-width: 44px; }
|
|
193
|
+
.settings-primary, .settings-secondary { display: flex; flex: none; align-items: stretch; }
|
|
194
|
+
.settings-primary { padding-inline: 12px; border-bottom: 1px solid var(--border); }
|
|
195
|
+
.settings-primary button { flex: 1; min-height: 44px; color: var(--fg-soft); }
|
|
196
|
+
.settings-primary [aria-pressed="true"] { color: var(--fg); font-weight: 700; position: relative; }
|
|
197
|
+
.settings-primary [aria-pressed="true"]::after { content: ""; position: absolute; bottom: 0; inset-inline: 30%; height: 2px; background: currentColor; }
|
|
198
|
+
.settings-secondary { align-self: flex-start; margin: 8px 12px 0; max-width: calc(100% - 24px); overflow-x: auto; overscroll-behavior-x: contain; background: var(--bg-hover); border-radius: 12px; padding: 3px; gap: 2px; }
|
|
199
|
+
.settings-secondary[hidden] { display: none; }
|
|
200
|
+
.settings-secondary button { flex: none; min-height: 44px; min-width: 44px; padding-inline: 12px; border-radius: 9px; font-size: 14px; }
|
|
201
|
+
.settings-secondary [aria-current="page"] { background: var(--fg); color: var(--bg); font-weight: 650; }
|
|
189
202
|
.settings-nav { display: none; flex: 1; border: 0; padding: 12px 16px; }
|
|
190
|
-
.settings-view.
|
|
191
|
-
.settings-view.
|
|
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; }
|
|
203
|
+
.settings-view.searching .settings-nav { display: block; }
|
|
204
|
+
.settings-view.searching :is(.settings-body,.settings-primary,.settings-secondary) { display: none; }
|
|
194
205
|
.settings-nav-link { min-height: 44px; padding-inline: 12px; }
|
|
195
206
|
.settings-search input[type="search"] { min-height: 44px; font-size: 16px; }
|
|
196
207
|
.settings-body {
|
package/web/css/settings.css
CHANGED
|
@@ -126,7 +126,6 @@ body:has(.settings) > :is(.overlay, .menu) {
|
|
|
126
126
|
.engine-advanced > .field { margin-top: 12px; }
|
|
127
127
|
.settings-page-title { max-width: 1100px; margin: 0 auto 16px; font-size: 21px; line-height: 1.4; }
|
|
128
128
|
.settings-header .grow { flex: 1; }
|
|
129
|
-
.settings-directory-back { display: none; }
|
|
130
129
|
.settings-sr { position: absolute; inline-size: 1px; block-size: 1px; clip-path: inset(50%); overflow: hidden; }
|
|
131
130
|
.settings-header button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
|
|
132
131
|
@media (forced-colors: active) {
|
|
@@ -770,12 +769,8 @@ body:has(.settings) > :is(.overlay, .menu) {
|
|
|
770
769
|
gap: 8px;
|
|
771
770
|
margin-top: 8px;
|
|
772
771
|
}
|
|
773
|
-
/* 一条记忆的按钮多,窄屏上文字占一整行,按钮换到下面 */
|
|
774
|
-
.memory-item {
|
|
775
|
-
flex-wrap: wrap;
|
|
776
|
-
}
|
|
777
772
|
.memory-item > .grow {
|
|
778
|
-
flex: 1
|
|
773
|
+
flex: 1;
|
|
779
774
|
min-width: 0;
|
|
780
775
|
overflow-wrap: anywhere;
|
|
781
776
|
}
|
|
@@ -784,3 +779,16 @@ a.memory-link {
|
|
|
784
779
|
color: inherit;
|
|
785
780
|
text-decoration: none;
|
|
786
781
|
}
|
|
782
|
+
|
|
783
|
+
.settings-primary, .settings-secondary, .settings-find { display: none; }
|
|
784
|
+
.memory-text { text-align: start; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 44px; width: 100%; }
|
|
785
|
+
.memory-item .icon-btn { min-width: 44px; min-height: 44px; }
|
|
786
|
+
|
|
787
|
+
.settings-record > summary, .srv-edit > summary {
|
|
788
|
+
min-height: 44px;
|
|
789
|
+
padding: 12px 8px;
|
|
790
|
+
cursor: pointer;
|
|
791
|
+
font-weight: 600;
|
|
792
|
+
overflow-wrap: anywhere;
|
|
793
|
+
}
|
|
794
|
+
.settings-record .status-tag { margin-inline-start: 8px; }
|
package/web/lib/overlay.js
CHANGED
|
@@ -156,10 +156,13 @@ export function closeMenu() {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
/** 弹窗只通过按钮关闭,点击遮罩不关闭。beforeClose:点 × 前先问它,false 就不关。返回的 close 直接关 */
|
|
159
|
-
export function modal({ title, body, foot, wide, tall, className = "", beforeClose }) {
|
|
159
|
+
export function modal({ title, body, foot, wide, tall, className = "", beforeClose, editor = false }) {
|
|
160
|
+
let dirty = false;
|
|
160
161
|
const close = () => overlay.remove();
|
|
161
162
|
const tryClose = async () => {
|
|
162
|
-
if (
|
|
163
|
+
if (beforeClose && (await beforeClose()) === false) return;
|
|
164
|
+
if (!beforeClose && dirty && !(await confirmDialog({ title: "有修改还没保存", message: "离开后将丢弃当前表单的修改。", confirmText: "不保存", danger: true }))) return;
|
|
165
|
+
close();
|
|
163
166
|
};
|
|
164
167
|
const overlay = h(
|
|
165
168
|
"div",
|
|
@@ -172,6 +175,16 @@ export function modal({ title, body, foot, wide, tall, className = "", beforeClo
|
|
|
172
175
|
foot ?? null,
|
|
173
176
|
),
|
|
174
177
|
);
|
|
178
|
+
if (ui.settings) overlay.addEventListener("settings-back", tryClose);
|
|
179
|
+
if (ui.settings && editor) {
|
|
180
|
+
overlay.classList.add("settings-editor");
|
|
181
|
+
if (!beforeClose) {
|
|
182
|
+
for (const type of ["input", "change"]) body.addEventListener(type, () => {
|
|
183
|
+
dirty = true;
|
|
184
|
+
overlay.dataset.edited = "";
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
175
188
|
document.body.append(overlay);
|
|
176
189
|
return close;
|
|
177
190
|
}
|
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;
|
package/web/settings/agents.js
CHANGED
|
@@ -223,9 +223,10 @@ function workbuddyLoginButton(after) {
|
|
|
223
223
|
export function agentsTab(cfg, page, section) {
|
|
224
224
|
const engines = ENGINES.filter(id => cfg.agents?.[id]);
|
|
225
225
|
const requested = section?.split("-")[0];
|
|
226
|
-
const selected = engines.includes(requested)
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
const selected = engines.includes(requested) ? requested : engines[0];
|
|
227
|
+
if (!selected) { page.append(h("p", { class: "muted" }, "没有可配置的引擎")); return; }
|
|
228
|
+
const picker = h("select", { "aria-label": "选择引擎" },
|
|
229
|
+
engines.map(id => h("option", { value: id }, ENGINE_LABEL[id])));
|
|
229
230
|
picker.value = selected;
|
|
230
231
|
picker.onchange = () => {
|
|
231
232
|
const target = picker.value;
|
|
@@ -233,12 +234,6 @@ export function agentsTab(cfg, page, section) {
|
|
|
233
234
|
void ui.settings.selectTab("engines/" + target);
|
|
234
235
|
};
|
|
235
236
|
page.append(field("配置对象", picker));
|
|
236
|
-
if (selected === "quota") {
|
|
237
|
-
const quota = quotaSection(cfg);
|
|
238
|
-
quota.dataset.section = "quota";
|
|
239
|
-
page.append(quota);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
237
|
const engine = selected;
|
|
243
238
|
const label = ENGINE_LABEL[engine];
|
|
244
239
|
const settings = cfg.agents[engine];
|
|
@@ -630,3 +625,7 @@ function quotaSection(cfg) {
|
|
|
630
625
|
),
|
|
631
626
|
);
|
|
632
627
|
}
|
|
628
|
+
|
|
629
|
+
export function quotaTab(cfg, page) {
|
|
630
|
+
page.append(quotaSection(cfg));
|
|
631
|
+
}
|
package/web/settings/commands.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { fill, h, icon } from "../lib/dom.js";
|
|
1
|
+
import { fill, h, icon, toast } from "../lib/dom.js";
|
|
2
|
+
import { ui } from "../state.js";
|
|
2
3
|
import { api } from "../lib/api.js";
|
|
3
4
|
import { agentLabel } from "../views/sidebar.js";
|
|
4
|
-
import { confirmDialog, modal } from "../lib/overlay.js";
|
|
5
|
+
import { confirmDialog, modal, showMenu } from "../lib/overlay.js";
|
|
5
6
|
import { clearCommandCache, commandUsage, currentAgentId, oneLine, preloadCommands } from "../views/slash.js";
|
|
6
7
|
import { field, hasDirty, markClean, markDirty, saveButton, saveConfig } from "./common.js";
|
|
7
8
|
|
|
@@ -105,6 +106,7 @@ function customDialog({ agent, entry, taken }, onSave) {
|
|
|
105
106
|
};
|
|
106
107
|
ok.onclick = () => void submit();
|
|
107
108
|
const close = modal({
|
|
109
|
+
editor: true,
|
|
108
110
|
title: entry ? `编辑 /${entry.name}` : `添加命令 · ${agentLabel(agent)}`,
|
|
109
111
|
body: h(
|
|
110
112
|
"div",
|
|
@@ -127,7 +129,7 @@ function customDialog({ agent, entry, taken }, onSave) {
|
|
|
127
129
|
* 设置 → 命令:每个 agent 一张表,拖动或用箭头排序,取消勾选就不在「/」列表里出现。
|
|
128
130
|
* 默认 agent-loft 内置命令按常用程度排在最前,agent 自己的命令排在后面且默认不勾(服务端 buildCatalog 决定)。
|
|
129
131
|
* 保存时把整张表的顺序存下来;以后新装的 skill 不在表里,会自动接在最后、默认不勾。
|
|
130
|
-
*
|
|
132
|
+
* 管理员可以增删改自定义提示词,与排序统一保存。
|
|
131
133
|
* 保存后服务端会同步到飞书机器人的指令面板,同步状态在「飞书」页里看。
|
|
132
134
|
*/
|
|
133
135
|
export function commandsTab(cfg, page) {
|
|
@@ -221,15 +223,12 @@ export function commandsTab(cfg, page) {
|
|
|
221
223
|
),
|
|
222
224
|
h("div", { class: "s" }, oneLine(c.description || c.prompt || "", 100) || "(无说明)"),
|
|
223
225
|
),
|
|
224
|
-
c.
|
|
225
|
-
? [
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
h("button", { class: "icon-btn", title: "置顶", onclick: () => move(i, 0) }, "⤒"),
|
|
231
|
-
h("button", { class: "icon-btn", title: "上移", onclick: () => move(i, i - 1) }, "↑"),
|
|
232
|
-
h("button", { class: "icon-btn", title: "下移", onclick: () => move(i, i + 1) }, "↓"),
|
|
226
|
+
h("button", { class: "icon-btn", "aria-label": "/" + c.name + " 更多操作", onclick: e => showMenu(e.currentTarget, [
|
|
227
|
+
...(c.source === "custom" ? [{ label: "编辑", onclick: () => editCustom(c) }, { label: "删除", danger: true, onclick: () => deleteCustom(c) }] : []),
|
|
228
|
+
{ label: "置顶", onclick: () => move(i, 0) },
|
|
229
|
+
{ label: "上移", onclick: () => move(i, i - 1) },
|
|
230
|
+
{ label: "下移", onclick: () => move(i, i + 1) },
|
|
231
|
+
]) }, icon("more")),
|
|
233
232
|
);
|
|
234
233
|
return row;
|
|
235
234
|
}),
|
|
@@ -250,13 +249,10 @@ export function commandsTab(cfg, page) {
|
|
|
250
249
|
custom: rows.filter((c) => c.source === "custom").map(({ name, description, prompt }) => ({ name, description, prompt })),
|
|
251
250
|
});
|
|
252
251
|
|
|
253
|
-
|
|
254
|
-
const commit = async (rows) => {
|
|
255
|
-
if (!(await save(prefsOf(rows)))) return false;
|
|
252
|
+
const stage = rows => {
|
|
256
253
|
list = rows;
|
|
257
254
|
renderList();
|
|
258
|
-
|
|
259
|
-
markClean(form);
|
|
255
|
+
markDirty(form);
|
|
260
256
|
return true;
|
|
261
257
|
};
|
|
262
258
|
const addCustom = () =>
|
|
@@ -266,20 +262,20 @@ export function commandsTab(cfg, page) {
|
|
|
266
262
|
const lastCustom = rows.findLastIndex((c) => c.source === "custom");
|
|
267
263
|
const at = lastCustom >= 0 ? lastCustom + 1 : rows.findLastIndex((c) => c.source === "agent-loft") + 1;
|
|
268
264
|
rows.splice(at, 0, { ...entry, source: "custom", runnable: true, hidden: false });
|
|
269
|
-
return
|
|
265
|
+
return stage(rows);
|
|
270
266
|
});
|
|
271
267
|
const editCustom = (c) =>
|
|
272
268
|
customDialog({ agent, entry: c, taken: list.filter((x) => x !== c).map((x) => x.name) }, (entry) =>
|
|
273
|
-
|
|
269
|
+
stage(list.map((x) => (x === c ? { ...x, ...entry } : x))),
|
|
274
270
|
);
|
|
275
271
|
const deleteCustom = async (c) => {
|
|
276
272
|
const sure = await confirmDialog({
|
|
277
273
|
title: `删除 /${c.name}?`,
|
|
278
|
-
message: "
|
|
274
|
+
message: "保存命令后在「/」列表和飞书指令面板里都不再出现。",
|
|
279
275
|
confirmText: "删除",
|
|
280
276
|
danger: true,
|
|
281
277
|
});
|
|
282
|
-
if (sure)
|
|
278
|
+
if (sure) stage(list.filter((x) => x !== c));
|
|
283
279
|
};
|
|
284
280
|
|
|
285
281
|
/** 换一个 agent 的表:这张表还有没保存的改动就先问 */
|
|
@@ -287,7 +283,7 @@ export function commandsTab(cfg, page) {
|
|
|
287
283
|
if (id === agent) return;
|
|
288
284
|
if (
|
|
289
285
|
hasDirty(page) &&
|
|
290
|
-
!(await confirmDialog({ title: "
|
|
286
|
+
!(await confirmDialog({ title: "命令还没保存", message: `${agentLabel(agent)} 的命令改动还没保存,切过去就不保存了。`, confirmText: "不保存", danger: true }))
|
|
291
287
|
)
|
|
292
288
|
return;
|
|
293
289
|
markClean(form);
|
|
@@ -300,6 +296,7 @@ export function commandsTab(cfg, page) {
|
|
|
300
296
|
fill(listBox, h("span", { class: "spinner" }));
|
|
301
297
|
try {
|
|
302
298
|
const data = await api(`/api/agents/${id}/commands`);
|
|
299
|
+
if (id !== agent) return;
|
|
303
300
|
list = data.commands;
|
|
304
301
|
renderList();
|
|
305
302
|
} catch (err) {
|
|
@@ -316,6 +313,7 @@ export function commandsTab(cfg, page) {
|
|
|
316
313
|
{ class: "muted" },
|
|
317
314
|
"在输入框里打「/」时弹出的命令,按这里的顺序排列;保存后会自动同步到飞书机器人的指令面板(同步状态在「飞书」里看)。取消勾选的不会出现在列表里,但照样可以手动输入。带 agent 名标记的是 agent 自己的命令(skills 等),默认不勾选,需要的话勾上并保存;它们会原样转给 agent。",
|
|
318
315
|
),
|
|
316
|
+
h("button", { class: "btn small", onclick: () => ui.settings.selectTab("feishu/slash") }, "查看飞书同步状态"),
|
|
319
317
|
tabs,
|
|
320
318
|
h("div", { class: "row cmd-tools" }, search, h("button", { class: "btn", onclick: () => addCustom() }, icon("plus"), "添加命令")),
|
|
321
319
|
listBox,
|
|
@@ -329,9 +327,15 @@ export function commandsTab(cfg, page) {
|
|
|
329
327
|
class: "btn",
|
|
330
328
|
onclick: async () => {
|
|
331
329
|
if (!(await confirmDialog({ title: "恢复默认?", message: `把 ${agentLabel(agent)} 的命令顺序和显示恢复成默认(自定义命令保留)。`, confirmText: "恢复默认" }))) return;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
330
|
+
const selected = agent;
|
|
331
|
+
try {
|
|
332
|
+
const { commands } = await api("/api/agents/" + agent + "/commands?defaults=1");
|
|
333
|
+
if (agent !== selected || !form.isConnected) return;
|
|
334
|
+
const custom = list.filter(c => c.source === "custom").map(c => ({ ...c, hidden: false }));
|
|
335
|
+
const names = new Set(custom.map(c => c.name));
|
|
336
|
+
stage([...commands.filter(c => c.source === "agent-loft"), ...custom,
|
|
337
|
+
...commands.filter(c => c.source === "agent" && !names.has(c.name))]);
|
|
338
|
+
} catch (err) { toast(err.message); }
|
|
335
339
|
},
|
|
336
340
|
},
|
|
337
341
|
"恢复默认",
|
package/web/settings/experts.js
CHANGED
|
@@ -208,11 +208,11 @@ function viewSharedExpert(e) {
|
|
|
208
208
|
|
|
209
209
|
function openTools(data, e, reload) {
|
|
210
210
|
const memos = expertMemoField(data.memoLibraries, e.id);
|
|
211
|
-
const skills = checkList(data.skills.map((s) => ({ id: s.id, label: s.name, hint: s.description })), e.skills, "
|
|
211
|
+
const skills = checkList(data.skills.map((s) => ({ id: s.id, label: s.name, hint: s.description })), e.skills, "还没有启用的技能(设置 → 助手 → 技能)");
|
|
212
212
|
const machine = (data.machineMcp?.[e.engine] ?? []).map((name) => ({ id: `${data.machinePrefix}${name}`, label: `${name}(本机)` }));
|
|
213
|
-
const mcp = checkList([...data.mcp.map((s) => ({ id: s.id, label: s.name, hint: s.description })), ...machine], e.mcp, "还没有 MCP
|
|
213
|
+
const mcp = checkList([...data.mcp.map((s) => ({ id: s.id, label: s.name, hint: s.description })), ...machine], e.mcp, "还没有 MCP(设置 → 助手 → MCP)");
|
|
214
214
|
const save = h("button", { class: "btn primary" }, "保存我的工具");
|
|
215
|
-
const close = modal({ title: `${e.name} · 我的工具`, body: h("div", { class: "modal-body" },
|
|
215
|
+
const close = modal({ editor: true, title: `${e.name} · 我的工具`, body: h("div", { class: "modal-body" },
|
|
216
216
|
h("p", { class: "muted" }, "只影响你使用这个专家时加载的工具,网页和绑定账号后的飞书私聊共用。未选择时不加载技能或 MCP;记忆使用你自己的设置。子智能体的工具需在对应专家中单独配置。"),
|
|
217
217
|
field("我的技能", skills.el), field("我的 MCP", mcp.el), memos.el,
|
|
218
218
|
), foot: h("div", { class: "modal-foot" }, save) });
|
|
@@ -348,7 +348,7 @@ function openEditor(data, e, reload, preset) {
|
|
|
348
348
|
const skills = checkList(
|
|
349
349
|
data.skills.map((s) => ({ id: s.id, label: s.name, hint: s.description })),
|
|
350
350
|
src.skills ?? [],
|
|
351
|
-
"
|
|
351
|
+
"还没有启用的技能(设置 → 助手 → 技能)",
|
|
352
352
|
);
|
|
353
353
|
const mcpBox = h("div");
|
|
354
354
|
const subBox = h("div");
|
|
@@ -361,7 +361,7 @@ function openEditor(data, e, reload, preset) {
|
|
|
361
361
|
mcp = checkList(
|
|
362
362
|
[...data.mcp.map((m) => ({ id: m.id, label: m.name, hint: m.description || (m.type === "http" ? "HTTP" : "本机进程") })), ...machine],
|
|
363
363
|
keep,
|
|
364
|
-
"还没有 MCP
|
|
364
|
+
"还没有 MCP(设置 → 助手 → MCP 里添加)",
|
|
365
365
|
);
|
|
366
366
|
fill(mcpBox, mcp.el);
|
|
367
367
|
const keepSubs = subs.value();
|
|
@@ -422,14 +422,14 @@ function openEditor(data, e, reload, preset) {
|
|
|
422
422
|
field("我的技能", skills.el, "只影响你的工具选择;共享后其他账号单独选择自己的技能"),
|
|
423
423
|
field("我的 MCP", mcpBox, "只使用你的 MCP;共享后不会把你的 MCP 或凭据交给其他账号"),
|
|
424
424
|
subField,
|
|
425
|
-
field("记忆", h("label", { class: "check-item" }, memory, h("span", {}, "使用聊天者自己的个人记忆(需在设置 → 记忆偏好开启)"))),
|
|
425
|
+
field("记忆", h("label", { class: "check-item" }, memory, h("span", {}, "使用聊天者自己的个人记忆(需在设置 → 个人 → 记忆 → 记忆偏好开启)"))),
|
|
426
426
|
),
|
|
427
427
|
section("新对话页", field("欢迎语", welcome), field("快捷提问", quick)),
|
|
428
428
|
);
|
|
429
429
|
renderEngineParts();
|
|
430
430
|
sync();
|
|
431
431
|
const save = h("button", { class: "btn primary" }, e ? "保存" : "创建");
|
|
432
|
-
const close = modal({ title: e ? `编辑 ${e.name}` : "新建专家", wide: true, tall: true, body, foot: h("div", { class: "modal-foot" }, save) });
|
|
432
|
+
const close = modal({ editor: true, title: e ? `编辑 ${e.name}` : "新建专家", wide: true, tall: true, body, foot: h("div", { class: "modal-foot" }, save) });
|
|
433
433
|
name.focus();
|
|
434
434
|
save.onclick = async () => {
|
|
435
435
|
const quickPrompts = quick.value
|
|
@@ -677,6 +677,7 @@ function openMcpValues(s, secrets, reload) {
|
|
|
677
677
|
});
|
|
678
678
|
const save = h("button", { class: "btn primary" }, "保存");
|
|
679
679
|
const close = modal({
|
|
680
|
+
editor: true,
|
|
680
681
|
title: `${s.name} 的密钥`,
|
|
681
682
|
body: h("div", { class: "modal-body task-form" }, h("p", { class: "skill-note" }, `${s.ownerName} 共享的 MCP。这些值只给你自己的会话用,作者看不到;不填就不带这一项。`), rows.map((r) => r.el)),
|
|
682
683
|
foot: h("div", { class: "modal-foot" }, save),
|
|
@@ -781,7 +782,7 @@ function openMcpEditor(s, reload) {
|
|
|
781
782
|
),
|
|
782
783
|
);
|
|
783
784
|
const save = h("button", { class: "btn primary" }, s ? "保存" : "添加");
|
|
784
|
-
const close = modal({ title: s ? `编辑 ${s.name}` : "添加 MCP", wide: true, body, foot: h("div", { class: "modal-foot" }, save) });
|
|
785
|
+
const close = modal({ editor: true, title: s ? `编辑 ${s.name}` : "添加 MCP", wide: true, body, foot: h("div", { class: "modal-foot" }, save) });
|
|
785
786
|
(s ? desc : name).focus();
|
|
786
787
|
save.onclick = async () => {
|
|
787
788
|
const payload = {
|
package/web/settings/feishu.js
CHANGED
|
@@ -143,7 +143,7 @@ export async function feishuTab(cfg, page) {
|
|
|
143
143
|
const sec = h(
|
|
144
144
|
"div",
|
|
145
145
|
{ class: "section", "data-form": "" },
|
|
146
|
-
h("h4", {},
|
|
146
|
+
h("h4", {}, "连接配置", h("span", { class: "grow" }), h("label", { class: "check" }, enabled, "启用")),
|
|
147
147
|
field("名称", name),
|
|
148
148
|
h("div", { class: "row" }, h("div", { style: { flex: 1 } }, field("App ID", appId)), h("div", { style: { flex: 1 } }, field("App Secret", secret))),
|
|
149
149
|
field("域名", domain),
|
|
@@ -191,7 +191,7 @@ export async function feishuTab(cfg, page) {
|
|
|
191
191
|
);
|
|
192
192
|
// 新加的还没存过:一开始就能点保存,离开时也会提醒
|
|
193
193
|
if (isDraft) markDirty(sec);
|
|
194
|
-
return sec;
|
|
194
|
+
return h("details", { class: "settings-record", open: isDraft }, h("summary", {}, b.name || "新机器人", isDraft ? " · 未保存" : status), sec);
|
|
195
195
|
};
|
|
196
196
|
|
|
197
197
|
const registerBot = async () => {
|
|
@@ -383,7 +383,7 @@ export async function feishuTab(cfg, page) {
|
|
|
383
383
|
slashTimer = data.bots.some((b) => b.status.state === "syncing") ? setTimeout(() => slashBox.isConnected && void loadSlash(), 2000) : null;
|
|
384
384
|
};
|
|
385
385
|
|
|
386
|
-
page.append(
|
|
386
|
+
page.append(pairBox, botsBox, slashBox);
|
|
387
387
|
render();
|
|
388
388
|
void loadStatus();
|
|
389
389
|
void loadPairing();
|
package/web/settings/general.js
CHANGED
|
@@ -13,10 +13,9 @@ export async function conversationTab(cfg, page) {
|
|
|
13
13
|
h(
|
|
14
14
|
"div",
|
|
15
15
|
{ class: "section", "data-form": "" },
|
|
16
|
-
h("h4", {}, "
|
|
16
|
+
h("h4", {}, "工作区与期限"),
|
|
17
17
|
field("工作目录(workspace)", root, "所有会话的默认目录,/cd 只能在它之内"),
|
|
18
18
|
field("会话闲置多久自动开新会话(小时)", ttl, "0 表示永不过期"),
|
|
19
|
-
field("授权卡等待多久(分钟)", approval, "agent 要执行命令、改文件时弹出的授权卡,没人处理超过这么久就按拒绝处理"),
|
|
20
19
|
h(
|
|
21
20
|
"div",
|
|
22
21
|
{ class: "row" },
|
|
@@ -24,11 +23,14 @@ export async function conversationTab(cfg, page) {
|
|
|
24
23
|
saveConfig(cfg, {
|
|
25
24
|
workspaceRoot: root.value,
|
|
26
25
|
sessionTtlMs: Number(ttl.value) * 3600000,
|
|
27
|
-
approvalTimeoutMs: Number(approval.value) * 60000,
|
|
28
26
|
}), "保存会话设置",
|
|
29
27
|
),
|
|
30
28
|
),
|
|
31
29
|
),
|
|
30
|
+
h("div", { class: "section", "data-form": "" },
|
|
31
|
+
h("h4", {}, "操作授权"),
|
|
32
|
+
field("授权卡等待多久(分钟)", approval, "agent 要执行命令、改文件时弹出的授权卡,没人处理超过这么久就按拒绝处理"),
|
|
33
|
+
saveButton(() => saveConfig(cfg, { approvalTimeoutMs: Number(approval.value) * 60000 }), "保存授权等待时间")),
|
|
32
34
|
allowBox,
|
|
33
35
|
);
|
|
34
36
|
const allowlist = await api("/api/claude/allowlist");
|
|
@@ -121,7 +123,7 @@ export function remoteTab(cfg, page) {
|
|
|
121
123
|
h(
|
|
122
124
|
"div",
|
|
123
125
|
{ class: "muted" },
|
|
124
|
-
"侧栏「远程控制」里直接操作这台机器的桌面和终端,切回对话时连接留在后台。以运行 agent-loft 的系统用户执行,没有授权卡。管理员能用;成员要在
|
|
126
|
+
"侧栏「远程控制」里直接操作这台机器的桌面和终端,切回对话时连接留在后台。以运行 agent-loft 的系统用户执行,没有授权卡。管理员能用;成员要在 管理 →「成员」里单独开通。",
|
|
125
127
|
),
|
|
126
128
|
status,
|
|
127
129
|
h("label", { class: "check" }, termOn, "网页终端"),
|