agent-loft 0.2.133 → 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 +31 -31
- 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 +10 -4
- package/src/mcp/memory-server.ts +1 -1
- package/web/css/mobile.css +19 -31
- package/web/css/settings.css +66 -37
- 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 +3 -16
- package/web/settings/agents.js +118 -95
- package/web/settings/commands.js +32 -29
- package/web/settings/experts.js +14 -12
- package/web/settings/feishu.js +6 -6
- package/web/settings/general.js +22 -17
- package/web/settings/index.js +193 -112
- package/web/settings/memory-sync.js +1 -1
- package/web/settings/memory.js +63 -73
- package/web/settings/notify.js +2 -2
- package/web/settings/security.js +14 -6
- package/web/settings/servers.js +6 -5
- package/web/settings/skills.js +9 -4
- package/web/settings/tabs.js +67 -51
- package/web/settings/usage.js +3 -3
- package/web/settings/users.js +25 -8
- package/web/settings/weixin.js +1 -1
- package/web/state.js +2 -2
- 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 +2 -2
- package/web/views/tasks.js +1 -1
- package/web/views/topbar.js +1 -1
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
|
|
|
@@ -11,7 +12,7 @@ import { field, hasDirty, markClean, markDirty, saveButton, saveConfig } from ".
|
|
|
11
12
|
* 拿不到就退回文本框手填,不挡住保存。思考程度的选项跟着所选模型变。
|
|
12
13
|
* 已保存但不在列表里的值(比如手填过的完整模型名)会作为「当前值」保留,不会被悄悄清掉。
|
|
13
14
|
*/
|
|
14
|
-
export function modelPicker(agent, model, effort, defaultLabel) {
|
|
15
|
+
export function modelPicker(agent, model, effort, defaultLabel, modelList = api(`/api/agents/${agent}/models`)) {
|
|
15
16
|
const modelSlot = h("div", { class: "picker" });
|
|
16
17
|
const effortSlot = h("div", { class: "picker" });
|
|
17
18
|
let getModel = () => model;
|
|
@@ -67,8 +68,7 @@ export function modelPicker(agent, model, effort, defaultLabel) {
|
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
loading(model ? `${model}(正在读取模型列表…)` : "正在读取模型列表…");
|
|
70
|
-
|
|
71
|
-
.then((data) => (data?.models?.length ? asSelect(data.models) : asText("没读到模型列表,请手填")))
|
|
71
|
+
modelList.then((data) => (data?.models?.length ? asSelect(data.models) : asText("没读到模型列表,请手填")))
|
|
72
72
|
.catch((err) => asText(err.status === 409 ? err.message : `读取模型列表失败,请手填:${err.message ?? err}`));
|
|
73
73
|
|
|
74
74
|
return { modelEl: modelSlot, effortEl: effortSlot, model: () => getModel(), effort: () => getEffort() };
|
|
@@ -106,6 +106,7 @@ function customDialog({ agent, entry, taken }, onSave) {
|
|
|
106
106
|
};
|
|
107
107
|
ok.onclick = () => void submit();
|
|
108
108
|
const close = modal({
|
|
109
|
+
editor: true,
|
|
109
110
|
title: entry ? `编辑 /${entry.name}` : `添加命令 · ${agentLabel(agent)}`,
|
|
110
111
|
body: h(
|
|
111
112
|
"div",
|
|
@@ -128,7 +129,7 @@ function customDialog({ agent, entry, taken }, onSave) {
|
|
|
128
129
|
* 设置 → 命令:每个 agent 一张表,拖动或用箭头排序,取消勾选就不在「/」列表里出现。
|
|
129
130
|
* 默认 agent-loft 内置命令按常用程度排在最前,agent 自己的命令排在后面且默认不勾(服务端 buildCatalog 决定)。
|
|
130
131
|
* 保存时把整张表的顺序存下来;以后新装的 skill 不在表里,会自动接在最后、默认不勾。
|
|
131
|
-
*
|
|
132
|
+
* 管理员可以增删改自定义提示词,与排序统一保存。
|
|
132
133
|
* 保存后服务端会同步到飞书机器人的指令面板,同步状态在「飞书」页里看。
|
|
133
134
|
*/
|
|
134
135
|
export function commandsTab(cfg, page) {
|
|
@@ -222,15 +223,12 @@ export function commandsTab(cfg, page) {
|
|
|
222
223
|
),
|
|
223
224
|
h("div", { class: "s" }, oneLine(c.description || c.prompt || "", 100) || "(无说明)"),
|
|
224
225
|
),
|
|
225
|
-
c.
|
|
226
|
-
? [
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
h("button", { class: "icon-btn", title: "置顶", onclick: () => move(i, 0) }, "⤒"),
|
|
232
|
-
h("button", { class: "icon-btn", title: "上移", onclick: () => move(i, i - 1) }, "↑"),
|
|
233
|
-
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")),
|
|
234
232
|
);
|
|
235
233
|
return row;
|
|
236
234
|
}),
|
|
@@ -251,13 +249,10 @@ export function commandsTab(cfg, page) {
|
|
|
251
249
|
custom: rows.filter((c) => c.source === "custom").map(({ name, description, prompt }) => ({ name, description, prompt })),
|
|
252
250
|
});
|
|
253
251
|
|
|
254
|
-
|
|
255
|
-
const commit = async (rows) => {
|
|
256
|
-
if (!(await save(prefsOf(rows)))) return false;
|
|
252
|
+
const stage = rows => {
|
|
257
253
|
list = rows;
|
|
258
254
|
renderList();
|
|
259
|
-
|
|
260
|
-
markClean(form);
|
|
255
|
+
markDirty(form);
|
|
261
256
|
return true;
|
|
262
257
|
};
|
|
263
258
|
const addCustom = () =>
|
|
@@ -267,20 +262,20 @@ export function commandsTab(cfg, page) {
|
|
|
267
262
|
const lastCustom = rows.findLastIndex((c) => c.source === "custom");
|
|
268
263
|
const at = lastCustom >= 0 ? lastCustom + 1 : rows.findLastIndex((c) => c.source === "agent-loft") + 1;
|
|
269
264
|
rows.splice(at, 0, { ...entry, source: "custom", runnable: true, hidden: false });
|
|
270
|
-
return
|
|
265
|
+
return stage(rows);
|
|
271
266
|
});
|
|
272
267
|
const editCustom = (c) =>
|
|
273
268
|
customDialog({ agent, entry: c, taken: list.filter((x) => x !== c).map((x) => x.name) }, (entry) =>
|
|
274
|
-
|
|
269
|
+
stage(list.map((x) => (x === c ? { ...x, ...entry } : x))),
|
|
275
270
|
);
|
|
276
271
|
const deleteCustom = async (c) => {
|
|
277
272
|
const sure = await confirmDialog({
|
|
278
273
|
title: `删除 /${c.name}?`,
|
|
279
|
-
message: "
|
|
274
|
+
message: "保存命令后在「/」列表和飞书指令面板里都不再出现。",
|
|
280
275
|
confirmText: "删除",
|
|
281
276
|
danger: true,
|
|
282
277
|
});
|
|
283
|
-
if (sure)
|
|
278
|
+
if (sure) stage(list.filter((x) => x !== c));
|
|
284
279
|
};
|
|
285
280
|
|
|
286
281
|
/** 换一个 agent 的表:这张表还有没保存的改动就先问 */
|
|
@@ -288,7 +283,7 @@ export function commandsTab(cfg, page) {
|
|
|
288
283
|
if (id === agent) return;
|
|
289
284
|
if (
|
|
290
285
|
hasDirty(page) &&
|
|
291
|
-
!(await confirmDialog({ title: "
|
|
286
|
+
!(await confirmDialog({ title: "命令还没保存", message: `${agentLabel(agent)} 的命令改动还没保存,切过去就不保存了。`, confirmText: "不保存", danger: true }))
|
|
292
287
|
)
|
|
293
288
|
return;
|
|
294
289
|
markClean(form);
|
|
@@ -301,6 +296,7 @@ export function commandsTab(cfg, page) {
|
|
|
301
296
|
fill(listBox, h("span", { class: "spinner" }));
|
|
302
297
|
try {
|
|
303
298
|
const data = await api(`/api/agents/${id}/commands`);
|
|
299
|
+
if (id !== agent) return;
|
|
304
300
|
list = data.commands;
|
|
305
301
|
renderList();
|
|
306
302
|
} catch (err) {
|
|
@@ -317,22 +313,29 @@ export function commandsTab(cfg, page) {
|
|
|
317
313
|
{ class: "muted" },
|
|
318
314
|
"在输入框里打「/」时弹出的命令,按这里的顺序排列;保存后会自动同步到飞书机器人的指令面板(同步状态在「飞书」里看)。取消勾选的不会出现在列表里,但照样可以手动输入。带 agent 名标记的是 agent 自己的命令(skills 等),默认不勾选,需要的话勾上并保存;它们会原样转给 agent。",
|
|
319
315
|
),
|
|
316
|
+
h("button", { class: "btn small", onclick: () => ui.settings.selectTab("feishu/slash") }, "查看飞书同步状态"),
|
|
320
317
|
tabs,
|
|
321
318
|
h("div", { class: "row cmd-tools" }, search, h("button", { class: "btn", onclick: () => addCustom() }, icon("plus"), "添加命令")),
|
|
322
319
|
listBox,
|
|
323
320
|
h(
|
|
324
321
|
"div",
|
|
325
322
|
{ class: "row" },
|
|
326
|
-
saveButton(() => save(prefsOf(list))),
|
|
323
|
+
saveButton(() => save(prefsOf(list)), "保存快捷命令"),
|
|
327
324
|
h(
|
|
328
325
|
"button",
|
|
329
326
|
{
|
|
330
327
|
class: "btn",
|
|
331
328
|
onclick: async () => {
|
|
332
329
|
if (!(await confirmDialog({ title: "恢复默认?", message: `把 ${agentLabel(agent)} 的命令顺序和显示恢复成默认(自定义命令保留)。`, confirmText: "恢复默认" }))) return;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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); }
|
|
336
339
|
},
|
|
337
340
|
},
|
|
338
341
|
"恢复默认",
|
package/web/settings/experts.js
CHANGED
|
@@ -2,7 +2,7 @@ import { agentIcon, fill, h, icon, toast } from "../lib/dom.js";
|
|
|
2
2
|
import { api } from "../lib/api.js";
|
|
3
3
|
import { expertMemoField } from "../lib/memo-access.js";
|
|
4
4
|
import { confirmDialog, modal, showMenu } from "../lib/overlay.js";
|
|
5
|
-
import { isAdmin, S } from "../state.js";
|
|
5
|
+
import { isAdmin, S, ui } from "../state.js";
|
|
6
6
|
import { openAgentDefaults } from "./agent-defaults.js";
|
|
7
7
|
import { expertIcon, reloadExperts, sortExperts } from "../views/experts.js";
|
|
8
8
|
import { baseName } from "../views/topbar.js";
|
|
@@ -92,7 +92,8 @@ function render(box, data, reload) {
|
|
|
92
92
|
h("span", { class: "badge" }, "内置"),
|
|
93
93
|
h("button", { class: "btn", "aria-label": `${e.name} 默认设置`, onclick: () => openAgentDefaults(e.engine, e.name) }, "设置"),
|
|
94
94
|
),
|
|
95
|
-
h("div", { class: "task-prompt" },
|
|
95
|
+
h("div", { class: "task-prompt" }, "使用引擎自带的提示词。默认权限和加载的工具按你的账号保存。"),
|
|
96
|
+
isAdmin() ? h("button", { class: "btn small", onclick: () => ui.settings.selectTab("engines/" + e.engine) }, "配置实例模型") : null,
|
|
96
97
|
) : expertCard(data, e, reload);
|
|
97
98
|
row.dataset.expert = e.id;
|
|
98
99
|
row.setAttribute("role", "listitem");
|
|
@@ -148,7 +149,7 @@ function render(box, data, reload) {
|
|
|
148
149
|
h(
|
|
149
150
|
"p",
|
|
150
151
|
{ class: "skill-note" },
|
|
151
|
-
"拖动卡片左侧手柄调整顺序,自动保存并用于选择智能体。专家决定引擎、提示词和能力。共享给所有账号后,设定由创建者维护,每个人的记忆、技能和 MCP 仍各自独立;点「我的工具」选择自己要用的工具。内置的 Claude Code、Codex
|
|
152
|
+
"拖动卡片左侧手柄调整顺序,自动保存并用于选择智能体。专家决定引擎、提示词和能力。共享给所有账号后,设定由创建者维护,每个人的记忆、技能和 MCP 仍各自独立;点「我的工具」选择自己要用的工具。内置的 Claude Code、Codex 在内置专家卡片的「设置」中选择技能和 MCP。",
|
|
152
153
|
),
|
|
153
154
|
h("div", { class: "skill-head-btns" }, add),
|
|
154
155
|
),
|
|
@@ -207,11 +208,11 @@ function viewSharedExpert(e) {
|
|
|
207
208
|
|
|
208
209
|
function openTools(data, e, reload) {
|
|
209
210
|
const memos = expertMemoField(data.memoLibraries, e.id);
|
|
210
|
-
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, "还没有启用的技能(设置 → 助手 → 技能)");
|
|
211
212
|
const machine = (data.machineMcp?.[e.engine] ?? []).map((name) => ({ id: `${data.machinePrefix}${name}`, label: `${name}(本机)` }));
|
|
212
|
-
const mcp = checkList([...data.mcp.map((s) => ({ id: s.id, label: s.name, hint: s.description })), ...machine], e.mcp, "还没有 MCP(设置 → MCP)");
|
|
213
|
+
const mcp = checkList([...data.mcp.map((s) => ({ id: s.id, label: s.name, hint: s.description })), ...machine], e.mcp, "还没有 MCP(设置 → 助手 → MCP)");
|
|
213
214
|
const save = h("button", { class: "btn primary" }, "保存我的工具");
|
|
214
|
-
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" },
|
|
215
216
|
h("p", { class: "muted" }, "只影响你使用这个专家时加载的工具,网页和绑定账号后的飞书私聊共用。未选择时不加载技能或 MCP;记忆使用你自己的设置。子智能体的工具需在对应专家中单独配置。"),
|
|
216
217
|
field("我的技能", skills.el), field("我的 MCP", mcp.el), memos.el,
|
|
217
218
|
), foot: h("div", { class: "modal-foot" }, save) });
|
|
@@ -347,7 +348,7 @@ function openEditor(data, e, reload, preset) {
|
|
|
347
348
|
const skills = checkList(
|
|
348
349
|
data.skills.map((s) => ({ id: s.id, label: s.name, hint: s.description })),
|
|
349
350
|
src.skills ?? [],
|
|
350
|
-
"还没有启用的技能(设置 → 技能)",
|
|
351
|
+
"还没有启用的技能(设置 → 助手 → 技能)",
|
|
351
352
|
);
|
|
352
353
|
const mcpBox = h("div");
|
|
353
354
|
const subBox = h("div");
|
|
@@ -360,7 +361,7 @@ function openEditor(data, e, reload, preset) {
|
|
|
360
361
|
mcp = checkList(
|
|
361
362
|
[...data.mcp.map((m) => ({ id: m.id, label: m.name, hint: m.description || (m.type === "http" ? "HTTP" : "本机进程") })), ...machine],
|
|
362
363
|
keep,
|
|
363
|
-
"还没有 MCP(设置 → MCP 里添加)",
|
|
364
|
+
"还没有 MCP(设置 → 助手 → MCP 里添加)",
|
|
364
365
|
);
|
|
365
366
|
fill(mcpBox, mcp.el);
|
|
366
367
|
const keepSubs = subs.value();
|
|
@@ -421,14 +422,14 @@ function openEditor(data, e, reload, preset) {
|
|
|
421
422
|
field("我的技能", skills.el, "只影响你的工具选择;共享后其他账号单独选择自己的技能"),
|
|
422
423
|
field("我的 MCP", mcpBox, "只使用你的 MCP;共享后不会把你的 MCP 或凭据交给其他账号"),
|
|
423
424
|
subField,
|
|
424
|
-
field("记忆", h("label", { class: "check-item" }, memory, h("span", {}, "使用聊天者自己的个人记忆(需在设置 →
|
|
425
|
+
field("记忆", h("label", { class: "check-item" }, memory, h("span", {}, "使用聊天者自己的个人记忆(需在设置 → 个人 → 记忆 → 记忆偏好开启)"))),
|
|
425
426
|
),
|
|
426
427
|
section("新对话页", field("欢迎语", welcome), field("快捷提问", quick)),
|
|
427
428
|
);
|
|
428
429
|
renderEngineParts();
|
|
429
430
|
sync();
|
|
430
431
|
const save = h("button", { class: "btn primary" }, e ? "保存" : "创建");
|
|
431
|
-
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) });
|
|
432
433
|
name.focus();
|
|
433
434
|
save.onclick = async () => {
|
|
434
435
|
const quickPrompts = quick.value
|
|
@@ -623,7 +624,7 @@ function renderMcp(box, data, reload) {
|
|
|
623
624
|
h(
|
|
624
625
|
"p",
|
|
625
626
|
{ class: "skill-note" },
|
|
626
|
-
"MCP 服务提供查数据、调接口等工具。这里加好后,自定义专家在「专家」里勾选;内置的 Claude Code / Codex
|
|
627
|
+
"MCP 服务提供查数据、调接口等工具。这里加好后,自定义专家在「专家」里勾选;内置的 Claude Code / Codex 在「专家」页内置卡片的「设置」中选择。可以把自己的 MCP 共享给所有账号:别人拿到的是地址、命令这些设置,标成密钥的项各自填自己的值,你的密钥不会给出去;别人用共享的 MCP 时,调用工具前都会先询问。" +
|
|
627
628
|
(canStdio ? "" : "本机进程(stdio)会在服务器上直接执行命令,只有管理员能添加。"),
|
|
628
629
|
),
|
|
629
630
|
h("div", { class: "skill-head-btns" }, h("button", { class: "btn primary", onclick: () => openMcpEditor(null, reload) }, icon("plus"), "添加")),
|
|
@@ -676,6 +677,7 @@ function openMcpValues(s, secrets, reload) {
|
|
|
676
677
|
});
|
|
677
678
|
const save = h("button", { class: "btn primary" }, "保存");
|
|
678
679
|
const close = modal({
|
|
680
|
+
editor: true,
|
|
679
681
|
title: `${s.name} 的密钥`,
|
|
680
682
|
body: h("div", { class: "modal-body task-form" }, h("p", { class: "skill-note" }, `${s.ownerName} 共享的 MCP。这些值只给你自己的会话用,作者看不到;不填就不带这一项。`), rows.map((r) => r.el)),
|
|
681
683
|
foot: h("div", { class: "modal-foot" }, save),
|
|
@@ -780,7 +782,7 @@ function openMcpEditor(s, reload) {
|
|
|
780
782
|
),
|
|
781
783
|
);
|
|
782
784
|
const save = h("button", { class: "btn primary" }, s ? "保存" : "添加");
|
|
783
|
-
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) });
|
|
784
786
|
(s ? desc : name).focus();
|
|
785
787
|
save.onclick = async () => {
|
|
786
788
|
const payload = {
|
package/web/settings/feishu.js
CHANGED
|
@@ -26,8 +26,8 @@ export async function feishuTab(cfg, page) {
|
|
|
26
26
|
const forms = new Map();
|
|
27
27
|
const statusTags = new Map();
|
|
28
28
|
const botsBox = h("div", { class: "settings-stack" });
|
|
29
|
-
const pairBox = h("div", { class: "settings-stack" });
|
|
30
|
-
const slashBox = h("div");
|
|
29
|
+
const pairBox = h("div", { "data-section": "pair", class: "settings-stack" });
|
|
30
|
+
const slashBox = h("div", { "data-section": "slash" });
|
|
31
31
|
|
|
32
32
|
const refresh = () => {
|
|
33
33
|
saved = structuredClone(cfg.feishu.bots);
|
|
@@ -51,7 +51,7 @@ export async function feishuTab(cfg, page) {
|
|
|
51
51
|
h(
|
|
52
52
|
"div",
|
|
53
53
|
{ class: "section" },
|
|
54
|
-
h("h4", {}, "
|
|
54
|
+
h("h4", {}, "机器人列表"),
|
|
55
55
|
h("div", { class: "muted" }, "勾选这个机器人可用的内置或共享专家,并选择默认专家。共享专家在每个人绑定账号后的私聊中使用各自的记忆和工具。扫码创建会自动建好飞书应用;Lark 国际版请用「手动添加」。"),
|
|
56
56
|
h(
|
|
57
57
|
"div",
|
|
@@ -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
|
@@ -5,18 +5,17 @@ import { field, saveButton, saveConfig } from "./common.js";
|
|
|
5
5
|
|
|
6
6
|
/** 设置 → 对话:所有会话共用的规矩——在哪个目录、多久算新会话、授权卡等多久、Claude 的「总是允许」 */
|
|
7
7
|
export async function conversationTab(cfg, page) {
|
|
8
|
-
const root = h("input", { value: cfg.workspaceRoot });
|
|
8
|
+
const root = h("input", { "data-section": "workspace", value: cfg.workspaceRoot });
|
|
9
9
|
const ttl = h("input", { type: "number", min: 0, value: Math.round(cfg.sessionTtlMs / 3600000) });
|
|
10
|
-
const approval = h("input", { type: "number", min: 1, value: Math.round(cfg.approvalTimeoutMs / 60000) });
|
|
11
|
-
const allowBox = h("div", { class: "section", "data-form": "" }, h("h4", {}, "Claude「总是允许」名单"), h("span", { class: "spinner" }));
|
|
10
|
+
const approval = h("input", { type: "number", "data-section": "approval", min: 1, value: Math.round(cfg.approvalTimeoutMs / 60000) });
|
|
11
|
+
const allowBox = h("div", { class: "section", "data-section": "allowlist", "data-form": "" }, h("h4", {}, "Claude「总是允许」名单"), h("span", { class: "spinner" }));
|
|
12
12
|
page.append(
|
|
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
|
-
|
|
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");
|
|
@@ -45,7 +47,7 @@ export async function conversationTab(cfg, page) {
|
|
|
45
47
|
saveButton(async () => {
|
|
46
48
|
await api("/api/claude/allowlist", { method: "PUT", body: { list: allowText.value.split("\n") } });
|
|
47
49
|
toast("已保存");
|
|
48
|
-
}),
|
|
50
|
+
}, "保存允许名单"),
|
|
49
51
|
),
|
|
50
52
|
);
|
|
51
53
|
}
|
|
@@ -117,11 +119,11 @@ export function remoteTab(cfg, page) {
|
|
|
117
119
|
h(
|
|
118
120
|
"div",
|
|
119
121
|
{ class: "section", "data-form": "" },
|
|
120
|
-
h("h4", {}, "
|
|
122
|
+
h("h4", {}, "终端与桌面"),
|
|
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, "网页终端"),
|
|
@@ -147,7 +149,7 @@ export function remoteTab(cfg, page) {
|
|
|
147
149
|
});
|
|
148
150
|
if (ok) void loadStatus();
|
|
149
151
|
return ok;
|
|
150
|
-
}),
|
|
152
|
+
}, "保存远程控制设置"),
|
|
151
153
|
),
|
|
152
154
|
),
|
|
153
155
|
);
|
|
@@ -163,11 +165,15 @@ function loopbackHost(host) {
|
|
|
163
165
|
* 网络访问:要不要让局域网里的其他设备打开、监听哪个端口。保存后服务端当场换过去,不用重启;
|
|
164
166
|
* 端口被占用之类的失败会直接报出来,原来的照常工作。
|
|
165
167
|
*/
|
|
166
|
-
export function
|
|
168
|
+
export function networkTab(cfg, page) {
|
|
169
|
+
page.append(networkSection(cfg));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function networkSection(cfg) {
|
|
167
173
|
const net = cfg.network ?? { lan: [], local: true, listening: null };
|
|
168
174
|
const box = h("div", { class: "section", "data-form": "" });
|
|
169
|
-
const lanOn = h("input", { type: "checkbox", checked: !loopbackHost(cfg.web.host) });
|
|
170
|
-
const port = h("input", { type: "number", min: 1, max: 65535, value: cfg.web.port });
|
|
175
|
+
const lanOn = h("input", { "data-section": "lan", type: "checkbox", checked: !loopbackHost(cfg.web.host) });
|
|
176
|
+
const port = h("input", { type: "number", min: 1, max: 65535, "data-section": "port", value: cfg.web.port });
|
|
171
177
|
const hint = h("small", {});
|
|
172
178
|
// 现在这个页面是不是直接连的这个端口(不是经由反代 / 隧道)
|
|
173
179
|
const pagePort = Number(location.port || (location.protocol === "https:" ? 443 : 80));
|
|
@@ -231,11 +237,10 @@ export function networkSection(cfg) {
|
|
|
231
237
|
|
|
232
238
|
fill(
|
|
233
239
|
box,
|
|
234
|
-
h("h4", {}, "网络访问"),
|
|
235
240
|
h("label", { class: "check" }, lanOn, "允许局域网内的其他设备访问"),
|
|
236
241
|
hint,
|
|
237
|
-
field("
|
|
238
|
-
h("div", { class: "row" }, saveButton(save)),
|
|
242
|
+
field("监听端口", port, "保存后立即生效"),
|
|
243
|
+
h("div", { class: "row" }, saveButton(save, "保存网络设置")),
|
|
239
244
|
);
|
|
240
245
|
return box;
|
|
241
246
|
}
|